diff --git a/test/bundler/bundler_compile.test.ts b/test/bundler/bundler_compile.test.ts index 6ac6a1970b6f..0e617c68b7b0 100644 --- a/test/bundler/bundler_compile.test.ts +++ b/test/bundler/bundler_compile.test.ts @@ -923,11 +923,12 @@ error: Hello World`, files: { "/entry.ts": /* js */ ` console.log("This is compiled code"); + console.log(JSON.stringify({ isStandaloneExecutable: Bun.isStandaloneExecutable })); `, }, run: [ { - stdout: "This is compiled code", + stdout: `This is compiled code\n{"isStandaloneExecutable":true}`, }, { env: { BUN_BE_BUN: "1" }, @@ -935,6 +936,17 @@ error: Hello World`, expect(stdout).not.toContain("This is compiled code"); }, }, + { + // With BUN_BE_BUN=1 the compiled executable behaves like the plain `bun` CLI: + // the embedded standalone module graph is never loaded, so Bun.isStandaloneExecutable + // must be false even though the binary itself contains one. + env: { BUN_BE_BUN: "1" }, + args: [ + "-e", + `console.log(JSON.stringify({ isStandaloneExecutable: Bun.isStandaloneExecutable, type: typeof Bun.isStandaloneExecutable }))`, + ], + stdout: `{"isStandaloneExecutable":false,"type":"boolean"}`, + }, ], });