fix: use pnpm_config_ instead of npm_config_ (#9571)

ref #9232
This commit is contained in:
Zoltan Kochan
2025-05-26 12:59:20 +02:00
parent 32dadefb53
commit 8d175c0b73
5 changed files with 16 additions and 9 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/config": patch
"pnpm": patch
---
Use `pnpm_config_` env variables instead of `npm_config_` [#9571](https://github.com/pnpm/pnpm/pull/9571).

View File

@@ -395,7 +395,8 @@ export async function getConfig (opts: {
}
pnpmConfig.extraEnv = {
npm_config_verify_deps_before_run: 'false',
npm_config_verify_deps_before_run: 'false', // This should be removed in pnpm v11
pnpm_config_verify_deps_before_run: 'false',
}
if (pnpmConfig.preferSymlinkedExecutables && !isWindows()) {
const cwd = pnpmConfig.lockfileDir ?? pnpmConfig.dir

View File

@@ -91,8 +91,8 @@ test('single package workspace', async () => {
expect(stdout.toString()).toContain('hello from exec')
}
// should set env.npm_config_verify_deps_before_run to false for the script (to skip check for nested script)
await execPnpm([...CONFIG, 'exec', 'node', '--eval', 'assert.strictEqual(process.env.npm_config_verify_deps_before_run, "false")'])
// should set env.pnpm_config_verify_deps_before_run to false for the script (to skip check for nested script)
await execPnpm([...CONFIG, 'exec', 'node', '--eval', 'assert.strictEqual(process.env.pnpm_config_verify_deps_before_run, "false")'])
})
test('multi-project workspace', async () => {
@@ -339,6 +339,6 @@ test('multi-project workspace', async () => {
expect(stdout.toString()).toContain(`hello from exec: ${process.cwd()}`)
}
// should set env.npm_config_verify_deps_before_run to false for all the scripts (to skip check for nested script)
await execPnpm([...CONFIG, 'exec', 'node', '--eval', 'assert.strictEqual(process.env.npm_config_verify_deps_before_run, "false")'])
// should set env.pnpm_config_verify_deps_before_run to false for all the scripts (to skip check for nested script)
await execPnpm([...CONFIG, 'exec', 'node', '--eval', 'assert.strictEqual(process.env.pnpm_config_verify_deps_before_run, "false")'])
})

View File

@@ -9,7 +9,7 @@ import { execPnpm, execPnpmSync, pnpmBinLocation } from '../utils'
const CONFIG = ['--config.verify-deps-before-run=error'] as const
test('single dependency', async () => {
const checkEnv = 'node --eval "assert.strictEqual(process.env.npm_config_verify_deps_before_run, \'false\')"'
const checkEnv = 'node --eval "assert.strictEqual(process.env.pnpm_config_verify_deps_before_run, \'false\')"'
const manifests: Record<string, ProjectManifest> = {
root: {
@@ -295,7 +295,7 @@ test('single dependency', async () => {
expect(stdout.toString()).toContain('hello from root')
}
// should set env.npm_config_verify_deps_before_run to false for all the scripts (to skip check in nested scripts)
// should set env.pnpm_config_verify_deps_before_run to false for all the scripts (to skip check in nested scripts)
await execPnpm([...CONFIG, '--recursive', 'run', 'checkEnv'])
})

View File

@@ -16,7 +16,7 @@ test('single dependency', async () => {
},
scripts: {
start: 'echo hello from script',
checkEnv: 'node --eval "assert.strictEqual(process.env.npm_config_verify_deps_before_run, \'false\')"',
checkEnv: 'node --eval "assert.strictEqual(process.env.pnpm_config_verify_deps_before_run, \'false\')"',
},
}
@@ -98,7 +98,7 @@ test('single dependency', async () => {
expect(stdout.toString()).toContain('hello from script')
}
// should set env.npm_config_verify_deps_before_run to false for the script (to skip check in nested script)
// should set env.pnpm_config_verify_deps_before_run to false for the script (to skip check in nested script)
await execPnpm([...CONFIG, 'run', 'checkEnv'])
})