Skip to content

Commit

Permalink
refactor(babel-node): Refactor babel-node tests configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
arku committed Apr 17, 2020
1 parent 0aa5a47 commit 6095c8b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
11 changes: 11 additions & 0 deletions packages/babel-node/test/configFile.json
@@ -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"]
}
16 changes: 1 addition & 15 deletions packages/babel-node/test/index.js
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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", "../configFile.json");
args = args.concat(opts.args);

const spawn = child.spawn(process.execPath, args);
Expand Down

0 comments on commit 6095c8b

Please sign in to comment.