Skip to content

Commit a3c1eeb

Browse files
committed
fix: Fix sanity check during npm run build:tries
Mocha wasn't executed properly during the sanity check.
1 parent 98b794d commit a3c1eeb

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

scripts/build-tries.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
"use strict";
22

3+
// Disabling promise ESLint rules because we can't use async/await here
4+
// before all supported Node versions support it.
5+
/* eslint-disable promise/always-return, promise/prefer-await-to-callbacks */
6+
37
const os = require("os");
48
const fs = require("fs");
59
const path = require("path");
@@ -38,7 +42,7 @@ const tries = [
3842
},
3943
];
4044

41-
process.stderr.write(`Downloading public suffix list from ${ PUBLIC_SUFFIX_URL }... `);
45+
process.stderr.write(`Downloading public suffix list from ${PUBLIC_SUFFIX_URL}... `);
4246

4347
got(PUBLIC_SUFFIX_URL)
4448
.then(res => {
@@ -61,24 +65,25 @@ got(PUBLIC_SUFFIX_URL)
6165
};
6266
})
6367
.forEach(file => {
64-
process.stderr.write(`Writing ${ file.path }... `);
68+
process.stderr.write(`Writing ${file.path}... `);
6569
mkdirp.sync(path.dirname(file.path));
6670
fs.writeFileSync(file.path, file.content, "utf8");
6771
process.stderr.write("ok" + os.EOL);
6872
})
6973
)
7074
.then(() => {
7175
process.stderr.write("Running sanity check... ");
72-
childProcess.spawnSync("mocha -R dot", {
76+
77+
childProcess.execFileSync(process.execPath, [require.resolve("mocha/bin/_mocha"), "-R", "dot"], {
7378
cwd: rootPath,
7479
encoding: "utf8",
75-
stdio: "ignore",
7680
});
81+
7782
process.stderr.write("ok" + os.EOL);
7883
})
7984
.catch(err => {
8085
console.error("");
81-
console.error("Could not update list of known top-level domains for parse-domain because of " + err.message);
86+
console.error(`Could not update list of known top-level domains for parse-domain because of "${err.message}"`);
8287

8388
const prebuiltList = JSON.parse(fs.readFileSync(path.resolve(triesPath, tries[0].filename), "utf8"));
8489

scripts/link-src.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ const path = require("path");
55

66
const rootFolder = path.resolve(__dirname, "..");
77

8-
fs.symlinkSync(path.resolve(rootFolder, "src"), path.resolve(rootFolder, "lib"));
8+
fs.symlinkSync(path.resolve(rootFolder, "src"), path.resolve(rootFolder, "lib"));

0 commit comments

Comments
 (0)