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

Side by Side 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.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« test/runners/webdriver.js ('K') | « test/runners/webdriver.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 }).then(bundle => 147 }).then(bundle =>
148 Promise.all( 148 Promise.all(
149 processes.map(currentProcess => 149 processes.map(currentProcess =>
150 runnerDefinitions[currentProcess]( 150 runnerDefinitions[currentProcess](
151 bundle, bundleFilename, 151 bundle, bundleFilename,
152 browserFiles.map( 152 browserFiles.map(
153 file => path.relative(path.join(__dirname, "test", "browser"), 153 file => path.relative(path.join(__dirname, "test", "browser"),
154 file).replace(/\.js$/, "") 154 file).replace(/\.js$/, "")
155 ) 155 )
156 ) 156 )
157 ) 157 // We need to convert rejected promise to a resolved one
158 ) 158 // 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
159 .catch(e => e)
160 )).then(results =>
161 {
162 let errors = results.filter(e => typeof e != "undefined");
163 if (errors.length)
164 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.
165 })
159 ); 166 );
160 } 167 }
161 168
162 if (process.argv.length > 2) 169 if (process.argv.length > 2)
163 addTestPaths(process.argv.slice(2), true); 170 addTestPaths(process.argv.slice(2), true);
164 else 171 else
165 { 172 {
166 addTestPaths( 173 addTestPaths(
167 [path.join(__dirname, "test"), path.join(__dirname, "test", "browser")], 174 [path.join(__dirname, "test"), path.join(__dirname, "test", "browser")],
168 true 175 true
169 ); 176 );
170 } 177 }
171 178
172 Promise.resolve(runBrowserTests(runnerProcesses)).catch(error => 179 runBrowserTests(runnerProcesses).then(() =>
173 {
174 console.error("Failed running browser tests");
175 console.error(error);
176 }).then(() =>
177 { 180 {
178 if (unitFiles.length) 181 if (unitFiles.length)
179 nodeunit.reporters.default.run(unitFiles); 182 nodeunit.reporters.default.run(unitFiles);
183 }).catch(error =>
184 {
185 console.error(error);
186 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
180 }); 187 });
OLDNEW
« 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