Skip to content

fix(@angular/cli): do not run e2e task if build fails #7902

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
Oct 6, 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
3 changes: 3 additions & 0 deletions docs/documentation/e2e.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ End-to-end tests are run via [Protractor] (https://angular.github.io/protractor/
<p>
Compile and Serve the app. All serve options are also available. The live-reload option defaults to false, and the default port will be random.
</p>
<p>
NOTE: Build failure will not launch the e2e task. You must first fix error(s) and run e2e again.
</p>
</details>

<details>
Expand Down
7 changes: 5 additions & 2 deletions packages/@angular/cli/commands/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,14 @@ const E2eCommand = Command.extend({
// Protractor will end the proccess, so we don't need to kill the dev server
return new Promise((resolve, reject) => {
let firstRebuild = true;
function rebuildCb() {
function rebuildCb(stats: any) {
// don't run re-run tests on subsequent rebuilds
if (firstRebuild) {
const cleanBuild = !!!stats.compilation.errors.length;
if (firstRebuild && cleanBuild) {
firstRebuild = false;
return resolve(e2eTask.run(commandOptions));
} else {
return reject('Build did not succeed. Please fix errors before running e2e task');
}
}

Expand Down