Skip to content

Commit 5f6a085

Browse files
committed
test(@angular/cli): disable sourcemaps by default in test suite
Note: this PR is for the repository test suite, not for project commands like `ng test`.
1 parent 64e6b94 commit 5f6a085

File tree

5 files changed

+13
-6
lines changed

5 files changed

+13
-6
lines changed

tests/e2e/tests/build/sourcemap.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default function() {
1010
return Promise.resolve();
1111
}
1212

13-
return ng('build')
13+
return ng('build', '--sourcemaps')
1414
.then(() => expectFileToExist('dist/main.bundle.js.map'))
1515

1616
.then(() => ng('build', '--no-sourcemap'))

tests/e2e/tests/build/vendor-chunk-symlink-node-module.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ export default function() {
99
.then(() => symlinkFile('../node_modules', 'node_modules', 'dir'))
1010
.then(() => ng('build'))
1111
.then(() => expectFileToExist('dist/vendor.bundle.js'))
12-
.then(() => expectFileToExist('dist/vendor.bundle.js.map'))
1312
// Cleanup
1413
.then(() => {
1514
return deleteFile('node_modules')

tests/e2e/tests/test/test-fail-watch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const karmaGoodRegEx = /Executed 3 of 3 SUCCESS \(\d+\.\d+ secs/;
1212

1313
export default function () {
1414
let originalSpec: string;
15-
return silentExecAndWaitForOutputToMatch('ng', ['test', '--no-progress'], karmaGoodRegEx)
15+
return silentExecAndWaitForOutputToMatch('ng', ['test'], karmaGoodRegEx)
1616
.then(() => readFile('src/app/app.component.spec.ts'))
1717
.then((data) => originalSpec = data)
1818
// Trigger a failed rebuild, which shouldn't run tests again.

tests/e2e/utils/process.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ function _exec(options: ExecOptions, cmd: string, args: string[]): Promise<Proce
2727
`==========================================================================================`
2828
);
2929

30+
// Auto-add some flags to ng commands that build or test the app.
31+
// --no-progress disables progress logging, which in CI logs thousands of lines.
32+
// --no-sourcemaps disables sourcemaps, making builds faster.
33+
// We add these flags before other args so that they can be overriden.
34+
// e.g. `--no-sourcemaps --sourcemaps` will still generate sourcemaps.
35+
if (cmd === 'ng' && ['build', 'serve', 'test', 'e2e', 'xi18n'].indexOf(args[0]) !== -1) {
36+
args = [args[0], '--no-progress', '--no-sourcemaps', ...args.slice(1)]
37+
}
38+
3039
args = args.filter(x => x !== undefined);
3140
const flags = [
3241
options.silent && 'silent',
@@ -139,7 +148,6 @@ export function silentExecAndWaitForOutputToMatch(cmd: string, args: string[], m
139148

140149
let npmInstalledEject = false;
141150
export function ng(...args: string[]) {
142-
// Auto-add --no-progress to commands that build the app, otherwise we get thousands of lines.
143151
if (['build', 'serve', 'test', 'e2e', 'xi18n'].indexOf(args[0]) != -1) {
144152
// If we have the --eject, use webpack for the test.
145153
const argv = getGlobalVariable('argv');
@@ -156,7 +164,7 @@ export function ng(...args: string[]) {
156164
.then(() => _exec({silent: true}, 'node_modules/.bin/webpack', []));
157165
}
158166

159-
return silentNg(...args, '--no-progress');
167+
return silentNg(...args);
160168
} else {
161169
return _exec({}, 'ng', args);
162170
}

tests/e2e/utils/project.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export function updateTsConfig(fn: (json: any) => any | void) {
2626

2727
export function ngServe(...args: string[]) {
2828
return silentExecAndWaitForOutputToMatch('ng',
29-
['serve', '--no-progress', ...args],
29+
['serve', ...args],
3030
/webpack: bundle is now VALID|webpack: Compiled successfully./);
3131
}
3232

0 commit comments

Comments
 (0)