-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
run-tuwpts.js
33 lines (28 loc) · 1.31 KB
/
run-tuwpts.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"use strict";
const path = require("path");
const { describe, before } = require("mocha-sugar-free");
const { spawnSync } = require("child_process");
const { readManifest, getPossibleTestFilePaths } = require("./wpt-manifest-utils.js");
const startWPTServer = require("./start-wpt-server.js");
const wptPath = path.resolve(__dirname, "tests");
const testsPath = path.resolve(__dirname, "to-upstream");
const manifestFilename = path.resolve(__dirname, "tuwpt-manifest.json");
// We can afford to re-generate the manifest each time; we have few enough files that it's cheap.
const testsRootArg = path.relative(wptPath, testsPath);
const pathArg = path.relative(wptPath, manifestFilename);
const args = ["./wpt.py", "manifest", "--tests-root", testsRootArg, "--path", pathArg, "--work"];
spawnSync("python", args, { cwd: wptPath, stdio: "inherit" });
const manifest = readManifest(manifestFilename);
const possibleTestFilePaths = getPossibleTestFilePaths(manifest);
let wptServerURL;
const runSingleWPT = require("./run-single-wpt.js")(() => wptServerURL);
before({ timeout: 30 * 1000 }, () => {
return startWPTServer({ toUpstream: true }).then(url => {
wptServerURL = url;
});
});
describe("Local tests in web-platform-test format (to-upstream)", () => {
for (const test of possibleTestFilePaths) {
runSingleWPT(test);
}
});