Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: test_runner.js

Issue 29874649: Issue 6822 - Report browser test errors (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: eslint fixes Created Sept. 20, 2018, 10:26 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« test/runners/webdriver.js ('K') | « test/runners/webdriver.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test_runner.js
===================================================================
--- a/test_runner.js
+++ b/test_runner.js
@@ -149,32 +149,39 @@
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.
Sebastian Noack 2018/09/21 14:22:21 Does that still hold true with the changes to test
hub 2018/09/21 15:39:35 Yes. The problem is that as soon as one of the pro
+ .catch(e => e)
+ )).then(results =>
+ {
+ let errors = results.filter(e => typeof e != "undefined");
+ if (errors.length)
+ return Promise.reject(`Browser unit test failed: ${errors.join(", ")}`);
Sebastian Noack 2018/09/21 14:22:21 Nit: You can just use throw here.
hub 2018/09/21 15:39:36 Done.
+ })
);
}
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 =>
+{
+ console.error(error);
+ process.exit(1);
Sebastian Noack 2018/09/21 14:22:21 What would happen if we just leave this error unha
hub 2018/09/21 15:39:36 Currently you get a warning about unhandled promis
});
« test/runners/webdriver.js ('K') | « test/runners/webdriver.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld