Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions test/bundler/bundler_compile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,19 @@ describe("bundler", () => {
expect(exitCode).toBe(0);
});
}
// The fixture module evaluates to whatever --compile inlined for `process.versions.bun`.
// That must be the exact version the embedded runtime reports, "-debug" suffix and all
// on debug builds, so the two are compared without normalizing either side.
itBundled("compile/HelloWorldWithProcessVersionsBun", {
compile: true,
files: {
"/entry.ts": /* js */ `
process.exitCode = 1;
process.versions.bun = "bun!";
if (process.versions.bun === "bun!") throw new Error("fail");
if (require("./${process.platform}-${process.arch}.js") === "${Bun.version.replaceAll("-debug", "")}") {
process.exitCode = 0;
}
const inlined = require("./${process.platform}-${process.arch}.js");
if (inlined !== Bun.version) throw new Error("inlined " + inlined + ", runtime is " + Bun.version);
process.exitCode = 0;
`,
[`/${process.platform}-${process.arch}.js`]: "module.exports = process.versions.bun;",
},
Expand All @@ -88,10 +91,9 @@ describe("bundler", () => {
process.exitCode = 1;
process.versions.bun = "bun!";
if (process.versions.bun === "bun!") throw new Error("fail");
const another = require("./${process.platform}-${process.arch}.js").replaceAll("-debug", "");
if (another === "${Bun.version.replaceAll("-debug", "")}") {
process.exitCode = 0;
}
const inlined = require("./${process.platform}-${process.arch}.js");
if (inlined !== Bun.version) throw new Error("inlined " + inlined + ", runtime is " + Bun.version);
process.exitCode = 0;
`,
[`/${process.platform}-${process.arch}.js`]: "module.exports = process.versions.bun;",
},
Expand Down