From 979b09f15e82936f59e6bfd26760c39ab7107592 Mon Sep 17 00:00:00 2001 From: robobun <117481402+robobun@users.noreply.github.com> Date: Sat, 6 Jun 2026 02:00:40 +0000 Subject: [PATCH] test: strip inherited npm_config_user_agent from bunEnv An outer bun run (e.g. launching the suite via bun bd test) injects npm_config_user_agent into the test runner's environment. Spawned buns keep a pre-existing value (put_default in run_command.rs), so the bunx user agent test compared the outer bun's user agent against the inner bun's Bun.version and failed whenever the two versions differ. --- test/harness.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/harness.ts b/test/harness.ts index ba13c607199b..541439ee1e90 100644 --- a/test/harness.ts +++ b/test/harness.ts @@ -66,6 +66,11 @@ export const bunEnv: NodeJS.Dict = { // Strip ad-hoc JSC debug options that may be set on CI agents — they leak // a "WARNING: failed to parse" line to stderr that breaks snapshot tests. JSC_useJIT: undefined, + // Strip the user agent injected by an outer `bun run` (e.g. when the suite + // is launched via `bun bd test`). Spawned buns honor a pre-existing value + // (put_default in run_command.rs), so tests asserting on the user agent + // would otherwise see the outer bun's version instead of bunExe()'s. + npm_config_user_agent: undefined, GITHUB_ACTIONS: "false", BUN_DEBUG_QUIET_LOGS: "1", NO_COLOR: "1",