refactor(babel-node): Refactor babel-node tests configuration (#11440)

This commit is contained in:
Arun Kumar Mohan 2020-04-20 15:03:58 -05:00 committed by GitHub
parent 1a08aa5adc
commit 7e6839f42b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 15 deletions

View File

@ -0,0 +1,11 @@
{
"presets": [
"../../babel-preset-env",
["../../babel-preset-react"]
],
"plugins": [
"../../babel-plugin-transform-strict-mode",
"../../babel-plugin-transform-modules-commonjs"
],
"only": ["../../../packages/*/test"]
}

View File

@ -20,16 +20,6 @@ const outputFileSync = function(filePath, data) {
fs.writeFileSync(filePath, data); fs.writeFileSync(filePath, data);
}; };
const presetLocs = [
path.join(__dirname, "../../babel-preset-env"),
path.join(__dirname, "../../babel-preset-react"),
].join(",");
const pluginLocs = [
path.join(__dirname, "/../../babel-plugin-transform-strict-mode"),
path.join(__dirname, "/../../babel-plugin-transform-modules-commonjs"),
].join(",");
const readDir = function(loc, filter) { const readDir = function(loc, filter) {
const files = {}; const files = {};
if (fs.existsSync(loc)) { if (fs.existsSync(loc)) {
@ -105,12 +95,8 @@ const buildTest = function(binName, testName, opts) {
return function(callback) { return function(callback) {
saveInFiles(opts.inFiles); saveInFiles(opts.inFiles);
let args = [binLoc]; let args = [binLoc];
args.push("--config-file", "../config.json");
args.push("--presets", presetLocs, "--plugins", pluginLocs);
args.push("--only", "../../../../packages/*/test");
args = args.concat(opts.args); args = args.concat(opts.args);
const spawn = child.spawn(process.execPath, args); const spawn = child.spawn(process.execPath, args);