Move @babel/node tests (#13037)

This commit is contained in:
Nicolò Ribaudo 2021-03-22 23:08:18 +01:00
parent 4f727139ec
commit afef4f85ff
60 changed files with 46 additions and 52 deletions

View File

@ -11,8 +11,9 @@ import { createRequire } from "module";
const require = createRequire(import.meta.url);
const dirname = path.dirname(fileURLToPath(import.meta.url));
const fixtureLoc = path.join(dirname, "fixtures");
const fixtureLoc = path.join(dirname, "fixtures", "cli");
const tmpLoc = path.join(dirname, "tmp");
const binLoc = path.join(dirname, "../lib/babel-node");
const fileFilter = function (x) {
return x !== ".DS_Store";
@ -93,9 +94,7 @@ const assertTest = function (stdout, stderr, opts) {
}
};
const buildTest = function (binName, testName, opts) {
const binLoc = path.join(dirname, "../lib", binName);
const buildTest = function (testName, opts) {
return function (callback) {
saveInFiles(opts.inFiles);
let args = [binLoc];
@ -139,11 +138,7 @@ const buildTest = function (binName, testName, opts) {
};
};
fs.readdirSync(fixtureLoc).forEach(function (binName) {
if (binName[0] === ".") return;
const suiteLoc = path.join(fixtureLoc, binName);
describe("bin/" + binName, function () {
describe("bin/babel-node", function () {
let cwd;
beforeEach(() => {
@ -164,10 +159,10 @@ fs.readdirSync(fixtureLoc).forEach(function (binName) {
process.chdir(cwd);
});
fs.readdirSync(suiteLoc).forEach(function (testName) {
fs.readdirSync(fixtureLoc).forEach(function (testName) {
if (testName[0] === ".") return;
const testLoc = path.join(suiteLoc, testName);
const testLoc = path.join(fixtureLoc, testName);
const opts = {
args: [],
@ -194,7 +189,6 @@ fs.readdirSync(fixtureLoc).forEach(function (binName) {
opts.inFiles[".babelrc"] = helper.readFile(babelrcLoc);
}
it(testName, buildTest(binName, testName, opts), 20000);
});
it(testName, buildTest(testName, opts), 20000);
});
});