Skip to content
This repository has been archived by the owner on Nov 3, 2022. It is now read-only.

Restore npm v6 behavior with INIT_CWD #12

Merged
merged 1 commit into from
Feb 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/set-envs.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const setEnvs = (config) => {
else
env.PREFIX = globalPrefix

env.INIT_CWD = env.INIT_CWD || process.cwd()
env.INIT_CWD = process.cwd()

// if the key is the default value,
// if the environ is NOT the default value,
Expand Down
4 changes: 2 additions & 2 deletions test/set-envs.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ t.test('set envs that are not defaults and not already in env, array style', t =
const cliConf = Object.create(envConf)
const extras = {
NODE,
INIT_CWD: '/some/other/path',
INIT_CWD: cwd,
EDITOR: 'vim',
HOME: undefined,
PREFIX: undefined,
npm_execpath: require.main.filename,
npm_node_execpath: execPath,
}
// make sure it's sticky
// make sure it's not sticky
const env = { INIT_CWD: '/some/other/path' }
const config = { list: [cliConf, envConf], env, defaults, execPath }
setEnvs(config)
Expand Down