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

Delta Between Two Patch Sets: test_runner.js

Issue 29874649: Issue 6822 - Report browser test errors (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Updated patch Created Sept. 6, 2018, 12:59 a.m.
Right Patch Set: throw instead of Promise.reject() Created Sept. 21, 2018, 3:39 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « test/runners/webdriver.js ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 } 146 }
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 ).catch(error => Promise.reject(
157 `Unit test "${currentProcess}" failed: ${error}`)
158 ) 156 )
159 ) 157 // We need to convert rejected promise to a resolved one
160 ) 158 // or the test will not let close the webdriver.
159 .catch(e => e)
160 )).then(results =>
161 {
162 let errors = results.filter(e => typeof e != "undefined");
163 if (errors.length)
164 throw `Browser unit test failed: ${errors.join(", ")}`;
165 })
161 ); 166 );
162 } 167 }
163 168
164 if (process.argv.length > 2) 169 if (process.argv.length > 2)
165 addTestPaths(process.argv.slice(2), true); 170 addTestPaths(process.argv.slice(2), true);
166 else 171 else
167 { 172 {
168 addTestPaths( 173 addTestPaths(
169 [path.join(__dirname, "test"), path.join(__dirname, "test", "browser")], 174 [path.join(__dirname, "test"), path.join(__dirname, "test", "browser")],
170 true 175 true
171 ); 176 );
172 } 177 }
173 178
174 Promise.resolve(runBrowserTests(runnerProcesses)).then(() => 179 runBrowserTests(runnerProcesses).then(() =>
175 { 180 {
176 if (unitFiles.length) 181 if (unitFiles.length)
177 nodeunit.reporters.default.run(unitFiles); 182 nodeunit.reporters.default.run(unitFiles);
178 }).catch(error => 183 }).catch(error =>
179 { 184 {
180 if (!error) 185 console.error(error);
181 console.error("Failed running browser tests");
182 else
183 console.error(error);
184 process.exit(1); 186 process.exit(1);
185 }); 187 });
LEFTRIGHT

Powered by Google App Engine
This is Rietveld