Files
Huáng JùnliàngandGitHub 16f37b5473 Add file URL support for test runners (#18002)
* test: accept URL in fixture test runner

* test: use URL for fixture calls

* test: extract systemjs-exec test into single file
2026-05-15 21:24:49 -04:00

30 lines
718 B
JavaScript

import { readFileSync } from "node:fs";
import {
runCodeInTestContext,
createTestContext,
} from "@babel/helper-transform-fixture-test-runner";
describe("systemjs exec", function () {
// https://github.com/babel/babel/issues/16219
it("should requeue helpers", function () {
const filename = new URL(
"./fixtures/preset-env/requeue-helpers/output.js",
import.meta.url,
);
const content = readFileSync(filename, "utf8");
let res;
const context = createTestContext();
context.System = {
register: function (_, module) {
res = module().execute();
},
};
runCodeInTestContext(content, { filename }, context);
expect(res).toBe("ok");
});
});