refactor(babel-node): Refactor babel-node tests configuration (#11440)
This commit is contained in:
parent
1a08aa5adc
commit
7e6839f42b
11
packages/babel-node/test/config.json
Normal file
11
packages/babel-node/test/config.json
Normal 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"]
|
||||
}
|
||||
@ -20,16 +20,6 @@ const outputFileSync = function(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 files = {};
|
||||
if (fs.existsSync(loc)) {
|
||||
@ -105,12 +95,8 @@ const buildTest = function(binName, testName, opts) {
|
||||
|
||||
return function(callback) {
|
||||
saveInFiles(opts.inFiles);
|
||||
|
||||
let args = [binLoc];
|
||||
|
||||
args.push("--presets", presetLocs, "--plugins", pluginLocs);
|
||||
args.push("--only", "../../../../packages/*/test");
|
||||
|
||||
args.push("--config-file", "../config.json");
|
||||
args = args.concat(opts.args);
|
||||
|
||||
const spawn = child.spawn(process.execPath, args);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user