Fix env variable handling in HOME .npmrc test

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 <noreply@anthropic.com>
This commit is contained in:
Claude Bot
2025-10-02 02:02:42 +00:00
parent 185a2cb236
commit 615bdc22f1

View File

@@ -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",
});