-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathgetLatestTests.js
38 lines (33 loc) · 1.3 KB
/
getLatestTests.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
34
35
36
37
38
"use strict";
if (process.env.NO_UPDATE) {
process.exit(0);
}
const fs = require("fs/promises");
const path = require("path");
const { unicodeVersion } = require("../package.json");
// Update this by going to https://github.com/web-platform-tests/wpt/tree/master/url/resources and pressing "y" on the
// keyboard.
const wptSHA = "72b915d4b3754f081ef5899bf6a777efe71b2fc5";
main().catch(e => {
console.error(e);
process.exit(1);
});
async function main() {
await Promise.all([
(async () => {
const target = path.resolve(__dirname, "../test/fixtures/IdnaTestV2.txt");
const response = await fetch(`https://unicode.org/Public/idna/${unicodeVersion}/IdnaTestV2.txt`);
await fs.writeFile(target, response.body);
})(),
(async () => {
const target = path.resolve(__dirname, "../test/fixtures/toascii.json");
const response = await fetch(`https://github.com/web-platform-tests/wpt/raw/${wptSHA}/url/resources/toascii.json`);
await fs.writeFile(target, response.body);
})(),
(async () => {
const target = path.resolve(__dirname, "../test/fixtures/IdnaTestV2ToASCII.json");
const response = await fetch(`https://github.com/web-platform-tests/wpt/raw/${wptSHA}/url/resources/IdnaTestV2.json`);
await fs.writeFile(target, response.body);
})()
]);
}