Skip to content

Commit 3bbf175

Browse files
adityaparabhansl
authored andcommitted
fix(@angular/cli): do not run e2e task if build fails
when ng e2e --serve=true is run and the build is not successful e2e task should not be run previously the e2e task was run even if build was a failure which will obviously result in failure of test cases now if errors are detected in build the e2e task will not be run update docs as well to reflect this behaviour Closes #7567
1 parent 04919f1 commit 3bbf175

File tree

2 files changed

+8
-2
lines changed
  • docs/documentation
  • packages/@angular/cli/commands

2 files changed

+8
-2
lines changed

docs/documentation/e2e.md

+3
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ End-to-end tests are run via [Protractor] (https://angular.github.io/protractor/
4242
<p>
4343
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.
4444
</p>
45+
<p>
46+
NOTE: Build failure will not launch the e2e task. You must first fix error(s) and run e2e again.
47+
</p>
4548
</details>
4649

4750
<details>

packages/@angular/cli/commands/e2e.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,14 @@ const E2eCommand = Command.extend({
107107
// Protractor will end the proccess, so we don't need to kill the dev server
108108
return new Promise((resolve, reject) => {
109109
let firstRebuild = true;
110-
function rebuildCb() {
110+
function rebuildCb(stats: any) {
111111
// don't run re-run tests on subsequent rebuilds
112-
if (firstRebuild) {
112+
const cleanBuild = !!!stats.compilation.errors.length;
113+
if (firstRebuild && cleanBuild) {
113114
firstRebuild = false;
114115
return resolve(e2eTask.run(commandOptions));
116+
} else {
117+
return reject('Build did not succeed. Please fix errors before running e2e task');
115118
}
116119
}
117120

0 commit comments

Comments
 (0)