Skip to content

test(@angular/cli): disable sourcemaps by default in test suite #6884

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions tests/e2e/setup/500-create-project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,18 @@ export default function() {
});
}
})
.then(() => updateJsonFile('.angular-cli.json', configJson => {
// Auto-add some flags to ng commands that build or test the app.
// --no-progress disables progress logging, which in CI logs thousands of lines.
// --no-sourcemaps disables sourcemaps, making builds faster.
// We add these flags before other args so that they can be overriden.
// e.g. `--no-sourcemaps --sourcemaps` will still generate sourcemaps.
const defaults = configJson.defaults;
defaults.build = {
sourcemaps: false,
progress: false
};
}))
.then(() => silentNpm('install'))
// Force sourcemaps to be from the root of the filesystem.
.then(() => updateTsConfig(json => {
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/tests/build/sourcemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default function() {
return Promise.resolve();
}

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

.then(() => ng('build', '--no-sourcemap'))
Expand Down
1 change: 0 additions & 1 deletion tests/e2e/tests/build/vendor-chunk-symlink-node-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export default function() {
.then(() => symlinkFile('../node_modules', 'node_modules', 'dir'))
.then(() => ng('build'))
.then(() => expectFileToExist('dist/vendor.bundle.js'))
.then(() => expectFileToExist('dist/vendor.bundle.js.map'))
// Cleanup
.then(() => {
return deleteFile('node_modules')
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/tests/test/test-fail-watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const karmaGoodRegEx = /Executed 3 of 3 SUCCESS \(\d+\.\d+ secs/;

export default function () {
let originalSpec: string;
return silentExecAndWaitForOutputToMatch('ng', ['test', '--no-progress'], karmaGoodRegEx)
return silentExecAndWaitForOutputToMatch('ng', ['test'], karmaGoodRegEx)
.then(() => readFile('src/app/app.component.spec.ts'))
.then((data) => originalSpec = data)
// Trigger a failed rebuild, which shouldn't run tests again.
Expand Down
3 changes: 1 addition & 2 deletions tests/e2e/utils/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ export function silentExecAndWaitForOutputToMatch(cmd: string, args: string[], m

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

return silentNg(...args, '--no-progress');
return silentNg(...args);
} else {
return _exec({}, 'ng', args);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/utils/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function updateTsConfig(fn: (json: any) => any | void) {

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

Expand Down