This repository was archived by the owner on Feb 15, 2022. It is now read-only.
forked from jsdom/whatwg-url
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget-latest-platform-tests.js
More file actions
58 lines (49 loc) · 1.62 KB
/
get-latest-platform-tests.js
File metadata and controls
58 lines (49 loc) · 1.62 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
"use strict";
if (process.env.NO_UPDATE) {
process.exit(0);
}
const fs = require("fs");
const path = require("path");
const util = require("util");
const stream = require("stream");
const clearDir = require("./clear-dir");
const got = require("got");
const pipeline = util.promisify(stream.pipeline);
process.on("unhandledRejection", err => {
throw err;
});
// Pin to specific version, reflecting the spec version in the readme.
//
// To get the latest commit:
// 1. Go to https://github.com/w3c/web-platform-tests/tree/master/url
// 2. Press "y" on your keyboard to get a permalink
// 3. Copy the commit hash
const commitHash = "11a6ab8df5f84d40d8818afe8773dd519e5263e4";
const urlPrefix = `https://raw.githubusercontent.com/web-platform-tests/wpt/${commitHash}/url/`;
const targetDir = path.resolve(__dirname, "..", "test", "web-platform-tests");
clearDir(targetDir);
fs.mkdirSync(path.resolve(targetDir, "resources"), { recursive: true });
for (const file of [
"resources/setters_tests.json",
"resources/toascii.json",
"resources/urltestdata.json",
"url-searchparams.any.js",
"url-setters-stripping.any.js",
"url-tojson.any.js",
"urlencoded-parser.any.js",
"urlsearchparams-append.any.js",
"urlsearchparams-constructor.any.js",
"urlsearchparams-delete.any.js",
"urlsearchparams-foreach.any.js",
"urlsearchparams-getall.any.js",
"urlsearchparams-get.any.js",
"urlsearchparams-has.any.js",
"urlsearchparams-set.any.js",
"urlsearchparams-sort.any.js",
"urlsearchparams-stringifier.any.js"
]) {
pipeline(
got.stream(`${urlPrefix}${file}`),
fs.createWriteStream(path.resolve(targetDir, file))
);
}