Skip to content

test: Bun.isStandaloneExecutable is false under BUN_BE_BUN=1 - #32606

Merged
alii merged 2 commits into
mainfrom
farm/78b1f9f2/test-bun-be-bun-isstandalone
Jun 22, 2026
Merged

alii merged 2 commits into
mainfrom
farm/78b1f9f2/test-bun-be-bun-isstandalone

Conversation

@robobun

@robobun robobun commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Extends the existing compile/BunBeBunEnvVar test to lock in how Bun.isStandaloneExecutable interacts with BUN_BE_BUN.

What this covers

A compiled (bun build --compile) executable:

  • run normally: bundled entrypoint executes and Bun.isStandaloneExecutable === true
  • run with BUN_BE_BUN=1 and -e <script>: the binary behaves like the plain bun CLI, the embedded standalone module graph is never loaded, and Bun.isStandaloneExecutable === false

Why

BUN_BE_BUN=1 short-circuits the Graph::from_executable() probe in src/runtime/cli/mod.rs, so the VM is created with no standalone module graph and Bun.isStandaloneExecutable (which is just vm.standalone_module_graph.is_some(), see BunObject.rs) reports false. This test pins that behavior so it can't silently change.

Verification

bun bd test test/bundler/bundler_compile.test.ts -t BunBeBunEnvVar
  (pass) bundler > compile/BunBeBunEnvVar

Extends the compile/BunBeBunEnvVar test to cover Bun.isStandaloneExecutable:
- the bundled entrypoint reports true when run normally
- running the compiled binary with BUN_BE_BUN=1 and '-e <script>' reports
  false, since the standalone module graph is skipped and the binary acts
  as the plain bun CLI
@robobun

robobun commented Jun 22, 2026 •

Copy link
Copy Markdown
Collaborator Author
Updated 4:53 PM PT - Jun 22nd, 2026

✅ @robobun, your commit 1ff03dcac684a418b55efd157c1a15ad36021fa8 passed in Build #63981! 🎉


🧪   To try this PR locally:

bunx bun-pr 32606

That installs a local version of the PR into your bun-32606 executable, so you can run:

bun-32606 --bun

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 6991803f-b7be-44ba-bdfb-a3171f87bfa1

📥 Commits

Reviewing files that changed from the base of the PR and between c1da139 and 1c3fb04.

📒 Files selected for processing (1)
  • test/bundler/bundler_compile.test.ts

Walkthrough

The compile/BunBeBunEnvVar test in bundler_compile.test.ts is updated to print Bun.isStandaloneExecutable as JSON from the compiled entry script. The default run now expects {"isStandaloneExecutable":true} in stdout. The BUN_BE_BUN=1 scenario is strengthened to run the compiled binary with a -e flag and assert isStandaloneExecutable is false with type boolean.

Changes

BunBeBunEnvVar test: isStandaloneExecutable assertions

Layer / File(s) Summary
BunBeBunEnvVar test assertion update
test/bundler/bundler_compile.test.ts
Entry script prints JSON.stringify({ isStandaloneExecutable: Bun.isStandaloneExecutable }); default run stdout updated to include {"isStandaloneExecutable":true}; BUN_BE_BUN=1 case adds a -e invocation that asserts isStandaloneExecutable is false with type:"boolean", replacing the previous weaker absence-only check.

Possibly related PRs

  • oven-sh/bun#32583: Introduces the Bun.isStandaloneExecutable API, which is the property being asserted in this PR's updated test.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: verifying that Bun.isStandaloneExecutable returns false when BUN_BE_BUN=1 is set.
Description check ✅ Passed The description covers both required template sections with detailed explanations of what the test covers, why it matters, and verification results.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — straightforward test-only extension pinning Bun.isStandaloneExecutable behavior under BUN_BE_BUN=1.

Extended reasoning...

Overview

This PR extends the existing compile/BunBeBunEnvVar test in test/bundler/bundler_compile.test.ts. It adds one console.log line to the compiled entrypoint, updates the first run's expected stdout accordingly, and appends a third run entry that invokes the compiled executable with BUN_BE_BUN=1 + -e <script> to assert Bun.isStandaloneExecutable === false. No production/runtime code is touched.

Security risks

None. This is a test-only change with no impact on shipped binaries, auth, crypto, permissions, or external inputs.

Level of scrutiny

Low. The change is small, mechanical, and follows the established pattern already used by the surrounding test (the second run entry already exercises BUN_BE_BUN=1 against the compiled output). I verified the expectBundled harness supports args on run entries (appended after the compiled executable path) and that env is already proven to work by the existing second run entry.

Other factors

  • The file is not covered by CODEOWNERS.
  • The bug-hunting system found no issues.
  • The PR description shows the test was run locally and passes.
  • The assertions mirror the existing standalone Bun.isStandaloneExecutable is false when not compiled test in the same file, so the expected JSON shape is consistent.

@alii
alii enabled auto-merge (squash) June 22, 2026 22:17

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — straightforward test-only extension of the existing BunBeBunEnvVar case.

Extended reasoning...

Overview

This PR touches a single file, test/bundler/bundler_compile.test.ts, and only modifies the existing compile/BunBeBunEnvVar test. It adds one console.log line to the compiled entry script, updates the expected stdout for the normal run accordingly, and adds a third run entry that invokes the compiled binary with BUN_BE_BUN=1 plus -e <script> to assert Bun.isStandaloneExecutable === false (and that its type is boolean). No production/runtime code is changed.

Security risks

None. This is purely additive test coverage; it executes a compiled hello-world binary in the test sandbox using the existing itBundled harness. No new dependencies, network access, file-system mutation outside the test temp dir, or auth/crypto surfaces are involved.

Level of scrutiny

Low. Test-only, ~13 lines added, follows patterns already present in the same file (the adjacent Bun.isStandaloneExecutable is false when not compiled test uses the identical JSON.stringify({ value, type }) shape, and other run array entries in this file already use env, args, and stdout). I confirmed the harness supports args on run entries (expectBundled.ts:376).

Other factors

  • No CODEOWNERS entry covers this file.
  • The bug-hunting system found no issues.
  • The one CI failure (grpc-js/test-server.test.ts SIGTRAP on macOS x64) is unrelated to this change.
  • The PR description states the test was run locally and passes.
  • No prior reviewer comments are outstanding.

@alii
alii merged commit 2d61142 into main Jun 22, 2026
77 checks passed
@alii
alii deleted the farm/78b1f9f2/test-bun-be-bun-isstandalone branch June 22, 2026 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants