Skip to content

Commit e96fbd3

Browse files
committed
refactor(@angular-devkit/build-angular): change errors and warnings messages
Sometimes the WARNING IN/ERROR IN can lead of ambiguous messages - Use `Warning` instead of `WARNING IN` - Use `Error` instead of `Error In`
1 parent 84e07e9 commit e96fbd3

File tree

15 files changed

+35
-38
lines changed

15 files changed

+35
-38
lines changed

packages/angular/cli/models/schematic-command.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ export abstract class SchematicCommand<
442442

443443
if (positions.length > 0) {
444444
const warning = tags.oneLine`
445-
WARNING: This command may not execute successfully.
445+
Warning: This command may not execute successfully.
446446
The package/collection may not support the 'targets' field within '${configPath}'.
447447
This can be corrected by renaming the following 'targets' fields to 'architect':
448448
`;

packages/angular_devkit/build_angular/src/browser/index.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ export function buildWebpackBrowser(
250250

251251
if (target > ScriptTarget.ES2015 && isDifferentialLoadingNeeded) {
252252
context.logger.warn(tags.stripIndent`
253-
WARNING: Using differential loading with targets ES5 and ES2016 or higher may
253+
Warning: Using differential loading with targets ES5 and ES2016 or higher may
254254
cause problems. Browsers with support for ES2015 will load the ES2016+ scripts
255255
referenced with script[type="module"] but they may not support ES2016+ syntax.
256256
`);
@@ -262,7 +262,7 @@ export function buildWebpackBrowser(
262262
const browsers =
263263
(hasIE9 ? 'IE 9' + (hasIE10 ? ' & ' : '') : '') + (hasIE10 ? 'IE 10' : '');
264264
context.logger.warn(
265-
`WARNING: Support was requested for ${browsers} in the project's browserslist configuration. ` +
265+
`Warning: Support was requested for ${browsers} in the project's browserslist configuration. ` +
266266
(hasIE9 && hasIE10 ? 'These browsers are' : 'This browser is') +
267267
' no longer officially supported with Angular v11 and higher.' +
268268
'\nFor additional information: https://v10.angular.io/guide/deprecations#ie-9-10-and-mobile',
@@ -654,13 +654,12 @@ export function buildWebpackBrowser(
654654
const budgets = options.budgets || [];
655655
const budgetFailures = checkBudgets(budgets, webpackStats, processResults);
656656
for (const { severity, message } of budgetFailures) {
657-
const msg = `budgets: ${message}`;
658657
switch (severity) {
659658
case ThresholdSeverity.Warning:
660-
webpackStats.warnings.push(msg);
659+
webpackStats.warnings.push(message);
661660
break;
662661
case ThresholdSeverity.Error:
663-
webpackStats.errors.push(msg);
662+
webpackStats.errors.push(message);
664663
break;
665664
default:
666665
assertNever(severity);

packages/angular_devkit/build_angular/src/browser/specs/browser-support_spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ describe('Browser Builder browser support', () => {
3535

3636
const fullLog = logs.join();
3737
expect(fullLog).toContain(
38-
"WARNING: Support was requested for IE 9 in the project's browserslist configuration.",
38+
"Warning: Support was requested for IE 9 in the project's browserslist configuration.",
3939
);
4040
expect(fullLog).toContain('This browser is ');
4141

@@ -55,7 +55,7 @@ describe('Browser Builder browser support', () => {
5555

5656
const fullLog = logs.join();
5757
expect(fullLog).toContain(
58-
"WARNING: Support was requested for IE 10 in the project's browserslist configuration.",
58+
"Warning: Support was requested for IE 10 in the project's browserslist configuration.",
5959
);
6060
expect(fullLog).toContain('This browser is ');
6161

@@ -75,7 +75,7 @@ describe('Browser Builder browser support', () => {
7575

7676
const fullLog = logs.join();
7777
expect(fullLog).toContain(
78-
"WARNING: Support was requested for IE 9 & IE 10 in the project's browserslist configuration.",
78+
"Warning: Support was requested for IE 9 & IE 10 in the project's browserslist configuration.",
7979
);
8080
expect(fullLog).toContain('These browsers are ');
8181

packages/angular_devkit/build_angular/src/browser/specs/bundle-budgets_spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ describe('Browser Builder bundle budgets', () => {
3333
const run = await architect.scheduleTarget(targetSpec, overrides, { logger });
3434
const output = await run.result;
3535
expect(output.success).toBe(true);
36-
expect(logs.join()).not.toContain('WARNING');
36+
expect(logs.join()).not.toContain('Warning');
3737
await run.stop();
3838
});
3939

@@ -61,7 +61,7 @@ describe('Browser Builder bundle budgets', () => {
6161
const run = await architect.scheduleTarget(targetSpec, overrides, { logger });
6262
const output = await run.result;
6363
expect(output.success).toBe(true);
64-
expect(logs.join()).toContain('WARNING');
64+
expect(logs.join()).toContain('Warning');
6565
await run.stop();
6666
});
6767

@@ -100,7 +100,7 @@ describe('Browser Builder bundle budgets', () => {
100100
const output = await run.result;
101101
expect(output.success).toBe(true);
102102
expect(logs.length).toBe(2);
103-
expect(logs.join()).toMatch(`WARNING.+app\.component\.${ext}`);
103+
expect(logs.join()).toMatch(`Warning.+app\.component\.${ext}`);
104104
await run.stop();
105105
});
106106
});
@@ -140,7 +140,7 @@ describe('Browser Builder bundle budgets', () => {
140140
const output = await run.result;
141141
expect(output.success).toBe(false);
142142
expect(logs.length).toBe(2);
143-
expect(logs.join()).toMatch(`ERROR.+app\.component\.${ext}`);
143+
expect(logs.join()).toMatch(`Error.+app\.component\.${ext}`);
144144
await run.stop();
145145
});
146146
});

packages/angular_devkit/build_angular/src/browser/specs/common-js-warning_spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ describe('Browser Builder commonjs warning', () => {
4646
const run = await architect.scheduleTarget(targetSpec, { aot }, { logger });
4747
const output = await run.result;
4848
expect(output.success).toBe(true);
49-
expect(logs.join()).not.toContain('WARNING');
49+
expect(logs.join()).not.toContain('Warning');
5050
await run.stop();
5151
});
5252

@@ -60,7 +60,7 @@ describe('Browser Builder commonjs warning', () => {
6060
const output = await run.result;
6161
expect(output.success).toBe(true);
6262
const logMsg = logs.join();
63-
expect(logMsg).toMatch(/WARNING in.+app\.component\.ts depends on 'bootstrap'\. CommonJS or AMD dependencies/);
63+
expect(logMsg).toMatch(/Warning: .+app\.component\.ts depends on 'bootstrap'\. CommonJS or AMD dependencies/);
6464
expect(logMsg).not.toContain('jquery', 'Should not warn on transitive CommonJS packages which parent is also CommonJS.');
6565
await run.stop();
6666
});
@@ -83,7 +83,7 @@ describe('Browser Builder commonjs warning', () => {
8383
const run = await architect.scheduleTarget(targetSpec, overrides, { logger });
8484
const output = await run.result;
8585
expect(output.success).toBe(true);
86-
expect(logs.join()).not.toContain('WARNING');
86+
expect(logs.join()).not.toContain('Warning');
8787
await run.stop();
8888
});
8989

@@ -97,7 +97,7 @@ describe('Browser Builder commonjs warning', () => {
9797
const output = await run.result;
9898
expect(output.success).toBe(true);
9999

100-
expect(logs.join()).not.toContain('WARNING');
100+
expect(logs.join()).not.toContain('Warning');
101101
await run.stop();
102102
});
103103

packages/angular_devkit/build_angular/src/browser/specs/web-worker_spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ describe('Browser Builder Web Worker support', () => {
104104
const mainContent = virtualFs.fileBufferToString(
105105
host.scopedSync().read(join(outputPath, 'main.js')));
106106
expect(mainContent).toContain('0.worker.js');
107-
expect(logs.join().includes('WARNING')).toBe(false, 'Should show no warnings.');
107+
expect(logs.join().includes('Warning')).toBe(false, 'Should show no warnings.');
108108
});
109109

110110
it('minimizes and hashes worker', async () => {

packages/angular_devkit/build_angular/src/dev-server/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ export function buildServerConfig(
376376
&& serverOptions.host !== 'localhost'
377377
) {
378378
logger.warn(tags.stripIndent`
379-
WARNING: This is a simple server for use in testing or debugging Angular applications
379+
Warning: This is a simple server for use in testing or debugging Angular applications
380380
locally. It hasn't been reviewed for security issues.
381381
382382
Binding this server to an open connection can result in compromising your application or
@@ -388,7 +388,7 @@ export function buildServerConfig(
388388

389389
if (serverOptions.disableHostCheck) {
390390
logger.warn(tags.oneLine`
391-
WARNING: Running a server with --disable-host-check is a security risk.
391+
Warning: Running a server with --disable-host-check is a security risk.
392392
See https://medium.com/webpack/webpack-dev-server-middleware-security-issues-1489d950874a
393393
for more information.
394394
`);
@@ -466,7 +466,7 @@ export function buildServePath(
466466
const showWarning = serverOptions.servePathDefaultWarning;
467467
if (defaultPath == null && showWarning) {
468468
logger.warn(tags.oneLine`
469-
WARNING: --deploy-url and/or --base-href contain unsupported values for ng serve. Default
469+
Warning: --deploy-url and/or --base-href contain unsupported values for ng serve. Default
470470
serve path of '/' used. Use --serve-path to override.
471471
`);
472472
}

packages/angular_devkit/build_angular/src/server/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export function execute(
7474
(main as string).includes('__ivy_ngcc__')
7575
) {
7676
context.logger.warn(tags.stripIndent`
77-
WARNING: Turning off 'bundleDependencies' with Ivy may result in undefined behaviour
77+
Warning: Turning off 'bundleDependencies' with Ivy may result in undefined behaviour
7878
unless 'node_modules' are transformed using the standalone Angular compatibility compiler (NGCC).
7979
See: http://v9.angular.io/guide/ivy#ivy-and-universal-app-shell
8080
`);

packages/angular_devkit/build_angular/src/webpack/configs/browser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export function getBrowserConfig(wco: WebpackConfigOptions): webpack.Configurati
4141
// TODO_WEBPACK_5: Investigate build/serve issues with the `license-webpack-plugin` package
4242
if (extractLicenses && isWebpackFiveOrHigher()) {
4343
wco.logger.warn(
44-
'WARNING: License extraction is currently disabled when using Webpack 5. ' +
44+
'Warning: License extraction is currently disabled when using Webpack 5. ' +
4545
'This is temporary and will be corrected in a future update.',
4646
);
4747
} else if (extractLicenses) {

packages/angular_devkit/build_angular/src/webpack/configs/common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
467467
wco.tsConfig.options.target >= ScriptTarget.ES2017
468468
) {
469469
wco.logger.warn(tags.stripIndent`
470-
WARNING: Zone.js does not support native async/await in ES2017.
470+
Warning: Zone.js does not support native async/await in ES2017.
471471
These blocks are not intercepted by zone.js and will not triggering change detection.
472472
See: https://github.com/angular/zone.js/pull/1140 for more information.
473473
`);

0 commit comments

Comments
 (0)