MCPcopy Create free account
hub / github.com/babel/babel / test

Function test

test/runtime-integration/node.cjs:67–97  ·  view source on GitHub ↗
(title, command, expectedName)

Source from the content-addressed store, hash-verified

65);
66
67function test(title, command, expectedName) {
68 const expectedPath = path.join(__dirname, expectedName);
69 const expected = fs.readFileSync(expectedPath, "utf8");
70
71 console.log(`Testing with Node.js ${process.version} - ${title}`);
72 const out = normalize(
73 cp.execSync(
74 `node ${
75 major === 23 || (major === 22 && minor >= 12)
76 ? "--disable-warning=ExperimentalWarning "
77 : ""
78 }${command}`,
79 {
80 cwd: __dirname,
81 encoding: "utf8",
82 }
83 )
84 );
85
86 if (expected === out) {
87 console.log("OK");
88 } else if (process.env.OVERWRITE) {
89 fs.writeFileSync(expectedPath, out);
90 console.log("UPDATED");
91 } else {
92 console.error("FAILED\n\n");
93 console.error(out);
94 process.exitCode = 1;
95 }
96 console.log("\n");
97}
98
99function normalize(output) {
100 const root = path.resolve(__dirname, "../..");

Callers 1

node.cjsFile · 0.70

Calls 1

normalizeFunction · 0.70

Tested by

no test coverage detected