Skip to content

Commit 73eee99

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 3417143 commit 73eee99

File tree

6 files changed

+16
-6
lines changed

6 files changed

+16
-6
lines changed

tests/e2e/setup/500-create-project.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,18 @@ export default function() {
6666
});
6767
}
6868
})
69+
.then(() => updateJsonFile('.angular-cli.json', configJson => {
70+
// Auto-add some flags to ng commands that build or test the app.
71+
// --no-progress disables progress logging, which in CI logs thousands of lines.
72+
// --no-sourcemaps disables sourcemaps, making builds faster.
73+
// We add these flags before other args so that they can be overriden.
74+
// e.g. `--no-sourcemaps --sourcemaps` will still generate sourcemaps.
75+
const defaults = configJson.defaults;
76+
defaults.build = {
77+
sourcemaps: false,
78+
progress: false
79+
};
80+
}))
6981
.then(() => silentNpm('install'))
7082
// Force sourcemaps to be from the root of the filesystem.
7183
.then(() => updateTsConfig(json => {

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: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ export function silentExecAndWaitForOutputToMatch(cmd: string, args: string[], m
139139

140140
let npmInstalledEject = false;
141141
export function ng(...args: string[]) {
142-
// Auto-add --no-progress to commands that build the app, otherwise we get thousands of lines.
143142
if (['build', 'serve', 'test', 'e2e', 'xi18n'].indexOf(args[0]) != -1) {
144143
// If we have the --eject, use webpack for the test.
145144
const argv = getGlobalVariable('argv');
@@ -156,7 +155,7 @@ export function ng(...args: string[]) {
156155
.then(() => _exec({silent: true}, 'node_modules/.bin/webpack', []));
157156
}
158157

159-
return silentNg(...args, '--no-progress');
158+
return silentNg(...args);
160159
} else {
161160
return _exec({}, 'ng', args);
162161
}

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)