Skip to content

Commit

Permalink
fix: Fix sanity check during npm run build:tries
Browse files Browse the repository at this point in the history
Mocha wasn't executed properly during the sanity check.
  • Loading branch information
jhnns committed May 27, 2019
1 parent 98b794d commit a3c1eeb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
15 changes: 10 additions & 5 deletions scripts/build-tries.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
"use strict";

// Disabling promise ESLint rules because we can't use async/await here
// before all supported Node versions support it.
/* eslint-disable promise/always-return, promise/prefer-await-to-callbacks */

const os = require("os");
const fs = require("fs");
const path = require("path");
Expand Down Expand Up @@ -38,7 +42,7 @@ const tries = [
},
];

process.stderr.write(`Downloading public suffix list from ${ PUBLIC_SUFFIX_URL }... `);
process.stderr.write(`Downloading public suffix list from ${PUBLIC_SUFFIX_URL}... `);

got(PUBLIC_SUFFIX_URL)
.then(res => {
Expand All @@ -61,24 +65,25 @@ got(PUBLIC_SUFFIX_URL)
};
})
.forEach(file => {
process.stderr.write(`Writing ${ file.path }... `);
process.stderr.write(`Writing ${file.path}... `);
mkdirp.sync(path.dirname(file.path));
fs.writeFileSync(file.path, file.content, "utf8");
process.stderr.write("ok" + os.EOL);
})
)
.then(() => {
process.stderr.write("Running sanity check... ");
childProcess.spawnSync("mocha -R dot", {

childProcess.execFileSync(process.execPath, [require.resolve("mocha/bin/_mocha"), "-R", "dot"], {
cwd: rootPath,
encoding: "utf8",
stdio: "ignore",
});

process.stderr.write("ok" + os.EOL);
})
.catch(err => {
console.error("");
console.error("Could not update list of known top-level domains for parse-domain because of " + err.message);
console.error(`Could not update list of known top-level domains for parse-domain because of "${err.message}"`);

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

Expand Down
2 changes: 1 addition & 1 deletion scripts/link-src.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ const path = require("path");

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

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

0 comments on commit a3c1eeb

Please sign in to comment.