[e2e] Fix exit code and paths for bots.

[email protected]
Change-Id: I23c5ed10eb5561129d249c6d16da2781f5f18c06
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2037485
Commit-Queue: Paul Lewis <[email protected]>
Reviewed-by: Liviu Rau <[email protected]>
Reviewed-by: Paul Lewis <[email protected]>
diff --git a/test/e2e/runner.ts b/test/e2e/runner.ts
index 4840512..08c2064 100644
--- a/test/e2e/runner.ts
+++ b/test/e2e/runner.ts
@@ -17,6 +17,8 @@
 const width = 1280;
 const height = 720;
 
+let exitCode = 0;
+
 const opts: puppeteer.LaunchOptions = {
   headless,
   executablePath: envChromeBinary,
@@ -101,6 +103,7 @@
   } finally {
     const browser = await launchedBrowser;
     browser.close();
+    process.exit(exitCode);
   }
 })();
 
@@ -139,6 +142,10 @@
       (mocha as any).unloadFiles();
       resolve();
     });
+
+    mochaRun.on('fail', () => {
+      exitCode = 1;
+    });
   });
 }