LEFT | RIGHT |
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 |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
16 */ | 16 */ |
17 | 17 |
18 /* eslint-env node */ | 18 /* eslint-env node */ |
19 | 19 |
20 "use strict"; | 20 "use strict"; |
21 | 21 |
22 const fs = require("fs"); | 22 const fs = require("fs"); |
23 const path = require("path"); | 23 const path = require("path"); |
24 | 24 |
25 const MemoryFS = require("memory-fs"); | 25 const MemoryFS = require("memory-fs"); |
26 const nodeunit = require("nodeunit"); | 26 const nodeunit = require("nodeunit"); |
27 const webpack = require("webpack"); | 27 const webpack = require("webpack"); |
28 | 28 |
| 29 const chromiumRemoteProcess = require("./test/runners/chromium_remote_process"); |
29 const chromiumProcess = require("./test/runners/chromium_process"); | 30 const chromiumProcess = require("./test/runners/chromium_process"); |
30 const chromiumWdProcess = require("./test/runners/chromiumwd_process"); | |
31 const firefoxProcess = require("./test/runners/firefox_process"); | 31 const firefoxProcess = require("./test/runners/firefox_process"); |
32 | 32 |
33 let unitFiles = []; | 33 let unitFiles = []; |
34 let browserFiles = []; | 34 let browserFiles = []; |
35 | 35 |
36 let runnerDefinitions = { | 36 let runnerDefinitions = { |
37 // Chromium with chrome-remote-interface | 37 // Chromium with chrome-remote-interface |
38 chromium_remote: chromiumProcess, | 38 chromium_remote: chromiumRemoteProcess, |
39 // Chromium with WebDriver ( >= 63.0.3239) | 39 // Chromium with WebDriver (requires Chromium >= 63.0.3239) |
40 chromium: chromiumWdProcess, | 40 chromium: chromiumProcess, |
41 firefox: firefoxProcess | 41 firefox: firefoxProcess |
42 }; | 42 }; |
43 | 43 |
44 function configureRunners() | 44 function configureRunners() |
45 { | 45 { |
46 let runners = "BROWSER_TEST_RUNNERS" in process.env ? | 46 let runners = "BROWSER_TEST_RUNNERS" in process.env ? |
47 process.env.BROWSER_TEST_RUNNERS.split(",") : []; | 47 process.env.BROWSER_TEST_RUNNERS.split(",") : []; |
48 | 48 |
49 if (runners.length == 0) | 49 if (runners.length == 0) |
50 return ["chromium", "firefox"]; | 50 return ["chromium_remote", "firefox"]; |
51 | 51 |
52 runners.filter(runner => runnerDefinitions.hasOwnProperty(runner)); | 52 return runners.filter(runner => runnerDefinitions.hasOwnProperty(runner)); |
53 | |
54 return runners; | |
55 } | 53 } |
56 | 54 |
57 let runnerProcesses = configureRunners(); | 55 let runnerProcesses = configureRunners(); |
58 | 56 |
59 function addTestPaths(testPaths, recurse) | 57 function addTestPaths(testPaths, recurse) |
60 { | 58 { |
61 for (let testPath of testPaths) | 59 for (let testPath of testPaths) |
62 { | 60 { |
63 let stat = fs.statSync(testPath); | 61 let stat = fs.statSync(testPath); |
64 if (stat.isDirectory()) | 62 if (stat.isDirectory()) |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 | 171 |
174 Promise.resolve(runBrowserTests(runnerProcesses)).catch(error => | 172 Promise.resolve(runBrowserTests(runnerProcesses)).catch(error => |
175 { | 173 { |
176 console.error("Failed running browser tests"); | 174 console.error("Failed running browser tests"); |
177 console.error(error); | 175 console.error(error); |
178 }).then(() => | 176 }).then(() => |
179 { | 177 { |
180 if (unitFiles.length) | 178 if (unitFiles.length) |
181 nodeunit.reporters.default.run(unitFiles); | 179 nodeunit.reporters.default.run(unitFiles); |
182 }); | 180 }); |
LEFT | RIGHT |