mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
pulled out of https://github.com/oven-sh/bun/pull/21809 +7 node tests --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
25 lines
649 B
JavaScript
25 lines
649 B
JavaScript
import { spawnSync } from "child_process";
|
|
import { writeFile } from "node:fs/promises";
|
|
import { builtinModules } from "node:module";
|
|
|
|
for (let builtin of builtinModules) {
|
|
const path = `/tmp/require.${builtin.replaceAll("/", "_")}.cjs`;
|
|
await writeFile(
|
|
path,
|
|
`
|
|
const builtin = ${JSON.stringify(builtin)};
|
|
const now = performance.now();
|
|
require(builtin);
|
|
const end = performance.now();
|
|
process.stdout.write(JSON.stringify({ builtin, time: end - now }) + "\\n");
|
|
`,
|
|
);
|
|
spawnSync(process.execPath, [path], {
|
|
stdio: ["inherit", "inherit", "inherit"],
|
|
env: {
|
|
...process.env,
|
|
NODE_NO_WARNINGS: "1",
|
|
},
|
|
});
|
|
}
|