/
githubmirror
/
babel
Обзор
Документация
Войти
/
githubmirror
/
babel
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/babel-node/test/helpers/runner.js
40 строк
1 KB
Huáng Jùnliàng
Add file URL support for test runners (#18002)
16 май 2026, 04:24
Не верифицирован
16 май 2026, 04:24
0b91d35
Код
Авторство
О чём код?
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" }`, ); } }, ), );