Skip to content

Commit

Permalink
feat: bump minimum node version (engines.node) (#613)
Browse files Browse the repository at this point in the history
  • Loading branch information
ybiquitous committed May 27, 2020
1 parent 5c5084e commit 7e2e276
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
".remarkignore"
],
"engines": {
"node": ">=10"
"node": ">=10.17.0"
},
"dependencies": {
"@commitlint/cli": "^8.3.5",
Expand Down
13 changes: 9 additions & 4 deletions test/init.test.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
const path = require("path");
const os = require("os");
const fs = require("fs");
const fse = require("fs-extra");
const test = require("tape");
const pkg = require("../package.json");
const init = require("../lib/init");
const exec = require("./helpers/exec");

const readFile = (file) => fse.readFile(file, "utf8");
const readJSON = (file) => fse.readJSON(file, "utf8");
/* eslint-disable node/no-unsupported-features/node-builtins */
const readFile = (file) => fs.promises.readFile(file, "utf8");
const readJSON = (file) => fs.promises.readFile(file, "utf8").then(JSON.parse);
/* eslint-enable node/no-unsupported-features/node-builtins */

const sandbox = async (fn, t) => {
const workDir = path.join(os.tmpdir(), `${pkg.name}${Date.now()}`);
await fse.mkdirs(workDir);
await fs.promises.mkdir(workDir); // eslint-disable-line node/no-unsupported-features/node-builtins

const logMsgs = [];
const logger = (msg) => logMsgs.push(msg);
Expand All @@ -22,7 +25,7 @@ const sandbox = async (fn, t) => {
const fixture = async (name) => {
const src = fixturePath(name);
const dest = path.join(workDir, "package.json");
await fse.copy(src, dest);
await fs.promises.copyFile(src, dest); // eslint-disable-line node/no-unsupported-features/node-builtins
return dest;
};

Expand All @@ -37,6 +40,8 @@ const sandbox = async (fn, t) => {
initArgs: { cwd: workDir, logger },
});
} finally {
// TODO: Node 12+
// await fs.promises.rmdir(workDir, { recursive: true });
await fse.remove(workDir);
}
};
Expand Down

0 comments on commit 7e2e276

Please sign in to comment.