diff --git a/docs/documentation/e2e.md b/docs/documentation/e2e.md
index 84b21fd14c36..3e507a34c455 100644
--- a/docs/documentation/e2e.md
+++ b/docs/documentation/e2e.md
@@ -42,6 +42,9 @@ End-to-end tests are run via [Protractor] (https://angular.github.io/protractor/
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.
+
+ NOTE: Build failure will not launch the e2e task. You must first fix error(s) and run e2e again.
+
diff --git a/packages/@angular/cli/commands/e2e.ts b/packages/@angular/cli/commands/e2e.ts
index c4496b948893..fc6d084816a8 100644
--- a/packages/@angular/cli/commands/e2e.ts
+++ b/packages/@angular/cli/commands/e2e.ts
@@ -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');
}
}