mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
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:
@@ -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",
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user