feat(e2e): run the CLI on Bun 1.4.3 and newer, without Node.js
The e2e CLI runs on Bun 1.4.3 or newer with no Node.js installed: bunx --bun e2e run. Node.js behavior does not change.
What changed
- Loader. e2e's Node.js loader runs on
module.registerHooks, which Bun lacks (oven-sh/bun#35690 is a draft). On Bun, e2e registers no hooks. Bun compiles TypeScript and resolves tsconfigpathsand#imports itself (config/bun-loader.ts). - Fresh instances. Bun ignores the query e2e uses on Node.js to key module instances. So the loader deletes the module from
require.cache, which holds ES modules too, and imports it again. A fresh graph also reloads every project file the entry imports by path,#import, or tsconfig alias.Bun.Transpiler.scanImportsandBun.resolveSyncfind those files. - Redaction. Bun's
consolewrites past theprocess.stdout.writethat e2e patches to redact secrets and route output. The loader pointsconsoleat the streams before any project code runs. - One run per process. Bun runs an imported module's top level outside its importer's AsyncLocalStorage context, and holds one instance of each module per process. Two runs in one process can't be kept apart, so on Bun:
e2e/runnerthrowsNODE_UNSUPPORTED. It already did, because of the missing hooks.e2e mcpopens one session at a time.
- Version guard. A Bun older than 1.4.3 gets the version to upgrade to: Bun 1.4.2 races a
require()of an ES module whose graph waits on top-level await. Deno is still refused. - Fixes Bun exposed:
- The signal ladder trusts
process.connectedonly when there is an IPC channel (cli/signals.ts). - Stack frames may have no column (
collect/registry.ts). - Config errors read Bun's syntax and resolve error shapes (
config/diagnose.ts).
- The signal ladder trusts
- Init. In a Bun project,
e2e initregisters the MCP server withbunx. - CI. A
bunjob runstests/integration/bun-runtime.test.tson Bun 1.4.3 and on the latest Bun. The CLI, and everything it spawns, gets a PATH with nonodeon it.
flowchart LR
L[load a config or test file] --> R{runtime}
R -- Node.js --> N["registerHooks + oxc<br/>an instance per ?e2e-graph= query"]
R -- Bun --> B["Bun compiles it<br/>delete from require.cache, import again"]
CLI reference, Bun lists what still differs on Bun:
#imports that map to a directory.- Legacy decorators in
.ctsfiles. - Watch mode and MCP read
tsconfig.jsonand computed-path imports one time. executable: 'node'underbun <file>.- The line reported for a test that a helper declares after an
await.
The mobile engine and the integrations are not verified on Bun yet.
Verified
Ran it locally: yes
-
Released e2e vs this branch:
e2e --versionon Bun 1.4.4, with only Bun and git on PATH.e2e 0.23.0 from npm this branch e2e runs on Node.js: Bun 1.4.4 reports Node.js 26.3.0 but has no module.registerHooks, which e2e's TypeScript loader needs.(exit 2)0.23.0. Thene2e doctoron the testbed prints✓ node Bun 1.4.4 (>=1.4.3)ande2e run can start here -
Testbed on Bun: the built CLI on Bun 1.4.4, run with
env -i PATH=<bun and git>:/usr/bin:/bin bun run e2e run. Same totals as on Node.js 24.19:Test Files 47 passed (47) Tests 587 passed | 1 skipped (588) Duration 23.41s -
e2e mcp --max-sessions 3on Bun: it logs that the flag is ignored. A secondopen_sessiongetsno session slot is free (e2e mcp --max-sessions 1). -
Reverting fixes: each Bun test added for a loader or MCP fix fails with its fix reverted. That covers reloading a JSX
.jsfile and a data file in a fresh graph, query imports, dotted aliases, console redaction, and the one-session cap.