Migrate to jest (#7455)

This commit is contained in:
Daniel Tschinder
2018-03-03 10:58:19 +01:00
committed by GitHub
parent 53208d6998
commit 3e95830646
29 changed files with 1861 additions and 1133 deletions

View File

@@ -122,7 +122,13 @@ const buildTest = function(binName, testName, opts) {
const binLoc = path.join(__dirname, "../lib", binName);
return function(callback) {
clear();
const dir = process.cwd();
process.chdir(__dirname);
if (fs.existsSync(tmpLoc)) rimraf.sync(tmpLoc);
fs.mkdirSync(tmpLoc);
process.chdir(tmpLoc);
saveInFiles(opts.inFiles);
let args = [binLoc];
@@ -160,6 +166,7 @@ const buildTest = function(binName, testName, opts) {
args.map(arg => `"${arg}"`).join(" ") + ": " + err.message;
}
process.chdir(dir);
callback(err);
});
@@ -170,13 +177,6 @@ const buildTest = function(binName, testName, opts) {
};
};
const clear = function() {
process.chdir(__dirname);
if (fs.existsSync(tmpLoc)) rimraf.sync(tmpLoc);
fs.mkdirSync(tmpLoc);
process.chdir(tmpLoc);
};
fs.readdirSync(fixtureLoc).forEach(function(binName) {
if (binName[0] === ".") return;