From 615bdc22f1ebd92daf09f8cf51e529cb4a51cd7e Mon Sep 17 00:00:00 2001 From: Claude Bot Date: Thu, 2 Oct 2025 02:02:42 +0000 Subject: [PATCH] Fix env variable handling in HOME .npmrc test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, the test was setting BUN_INSTALL_CACHE_DIR: undefined which passes the literal string "undefined" to the child process. This fix properly sets BUN_INSTALL_CACHE_DIR to a temporary directory within the test directory to isolate the test from the user's actual cache. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- test/cli/install/npmrc.test.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/cli/install/npmrc.test.ts b/test/cli/install/npmrc.test.ts index 10343dd0ab..27a201a115 100644 --- a/test/cli/install/npmrc.test.ts +++ b/test/cli/install/npmrc.test.ts @@ -481,15 +481,15 @@ cache=${customHome}/.npm-cache ); // Run install with modified HOME + const childEnv = { ...env }; + childEnv.BUN_INSTALL_CACHE_DIR = join(packageDir, ".bun-cache"); + childEnv.HOME = customHome; + childEnv.USERPROFILE = customHome; // Windows uses USERPROFILE instead of HOME + const { stdout, stderr, exited } = Bun.spawn({ cmd: [bunExe(), "install"], cwd: packageDir, - env: { - ...env, - HOME: customHome, - USERPROFILE: customHome, // Windows uses USERPROFILE instead of HOME - BUN_INSTALL_CACHE_DIR: undefined, - }, + env: childEnv, stdout: "pipe", stderr: "pipe", });