mirror of
https://github.com/hanzoai/babel.git
synced 2026-09-24 16:56:45 +00:00
* test: accept URL in fixture test runner * test: use URL for fixture calls * test: extract systemjs-exec test into single file
41 lines
1.2 KiB
JavaScript
41 lines
1.2 KiB
JavaScript
import path from "node:path";
|
|
import { writeFileSync } from "node:fs";
|
|
import { commonJS } from "$repo-utils";
|
|
import {
|
|
buildProcessTests,
|
|
buildParallelProcessTests,
|
|
} from "@babel/helper-transform-fixture-test-runner";
|
|
|
|
const { require, __dirname } = commonJS(import.meta.url);
|
|
|
|
const binLoc = path.join(__dirname, "../../lib/babel-node");
|
|
|
|
export const runParallel = buildParallelProcessTests(
|
|
"babel-node",
|
|
buildProcessTests(
|
|
new URL("../fixtures", import.meta.url),
|
|
function (test, tmpDir) {
|
|
test.binLoc = binLoc;
|
|
test.opts.env = { ...test.opts.env, BABEL_DISABLE_CACHE: true };
|
|
if (test.testName === "require") {
|
|
writeFileSync(
|
|
path.join(tmpDir, ".babelrc"),
|
|
JSON.stringify({
|
|
presets: [
|
|
require.resolve("@babel/preset-env"),
|
|
[require.resolve("@babel/preset-react"), { runtime: "classic" }],
|
|
],
|
|
}),
|
|
);
|
|
}
|
|
if (!test.opts.inFiles["package.json"]) {
|
|
test.opts.inFiles["package.json"] = `{ "type": "commonjs" }`;
|
|
writeFileSync(
|
|
path.join(tmpDir, "package.json"),
|
|
`{ "type": "commonjs" }`,
|
|
);
|
|
}
|
|
},
|
|
),
|
|
);
|