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

Side by Side Diff: test/all.js

Issue 29866577: Issue 6887 - add Chrome to "npm test" (Closed)
Patch Set: Created Sept. 1, 2018, 9:37 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
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/>.
16 */
17
18 /* eslint-env mocha */
19
20 "use strict";
21
22 const glob = require("glob");
23 const path = require("path");
24 const {exec} = require("child_process");
25
26 for (let browser of glob.sync("./test/browsers/*.js"))
27 {
28 let module = require(path.resolve(browser));
29
30 describe(module.platform, function()
31 {
32 this.timeout(0);
33
34 before(function()
35 {
36 return new Promise((resolve, reject) =>
37 {
38 exec(`python build.py devenv -t ${module.platform}`,
39 (error, stdout, stderr) =>
40 {
41 if (error)
42 {
43 console.error(stderr);
44 reject(error);
45 }
46 else resolve(stdout);
47 });
48 }).then(() => module.getDriver(
49 path.resolve(`./devenv.${module.platform}`)).then(d =>
50 {
51 this.driver = d;
Sebastian Noack 2018/09/01 10:42:47 Nit: The reason we called the argument "d" (rather
tlucas 2018/09/01 11:54:23 Done.
52 return this.driver.wait(() =>
53 this.driver.getAllWindowHandles().then(handles => handles[1])
54 );
55 }).then(handle =>
56 this.driver.switchTo().window(handle)
57 ).then(() =>
58 this.driver.executeScript("return location.origin;")
59 ).then(o =>
60 {
61 this.origin = o;
62 this.platform = module.platform;
63 }));
64 });
65
66 for (let file of glob.sync("./test/wrappers/*.js"))
67 {
68 // Reload the module(s) for every browser
69 delete require.cache[require.resolve(path.resolve(file))];
Sebastian Noack 2018/09/01 10:42:47 Why would they already be in cache? Isn't this the
tlucas 2018/09/01 11:54:24 We (want to) require them 2 times currently, once
Sebastian Noack 2018/09/01 12:26:33 Acknowledged.
70 require(path.resolve(file));
71 }
72
73 after(function()
74 {
75 this.driver.quit();
76 });
77 });
78 }
OLDNEW
« no previous file with comments | « package.json ('k') | test/browsers/chromium.js » ('j') | test/wrappers/qunit.js » ('J')

Powered by Google App Engine
This is Rietveld