| Index: test_runner.js | 
| =================================================================== | 
| --- a/test_runner.js | 
| +++ b/test_runner.js | 
| @@ -140,41 +140,50 @@ | 
| }, | 
| resolve: { | 
| alias: { | 
| nodeunit$: nodeunitPath | 
| }, | 
| modules: [path.resolve(__dirname, "lib")] | 
| } | 
| }).then(bundle => | 
| - Promise.all( | 
| - processes.map(currentProcess => | 
| + Promise.all(processes.map(currentProcess => | 
| runnerDefinitions[currentProcess]( | 
| bundle, bundleFilename, | 
| browserFiles.map( | 
| file => path.relative(path.join(__dirname, "test", "browser"), | 
| file).replace(/\.js$/, "") | 
| ) | 
| ) | 
| - ) | 
| - ) | 
| + // We need to convert rejected promise to a resolved one | 
| + // or the test will not let close the webdriver. | 
| + .catch(e => e) | 
| + )).then(results => | 
| + { | 
| + let errors = results.filter(e => typeof e != "undefined"); | 
| + if (errors.length) | 
| + return Promise.reject(`Unit test failed: ${errors.join(", ")}`); | 
| + }) | 
| ); | 
| } | 
| if (process.argv.length > 2) | 
| addTestPaths(process.argv.slice(2), true); | 
| else | 
| { | 
| addTestPaths( | 
| [path.join(__dirname, "test"), path.join(__dirname, "test", "browser")], | 
| true | 
| ); | 
| } | 
| -Promise.resolve(runBrowserTests(runnerProcesses)).catch(error => | 
| -{ | 
| - console.error("Failed running browser tests"); | 
| - console.error(error); | 
| -}).then(() => | 
| +runBrowserTests(runnerProcesses).then(() => | 
| { | 
| if (unitFiles.length) | 
| nodeunit.reporters.default.run(unitFiles); | 
| +}).catch(error => | 
| +{ | 
| + if (!error) | 
| + console.error("Failed running browser tests"); | 
| + else | 
| + console.error(error); | 
| + process.exit(1); | 
| }); |