feat!: change default values of optimisticRepeatInstall and verifyDepsBeforeRun (#10822)

This commit is contained in:
Zoltan Kochan
2026-03-01 17:48:13 +01:00
committed by GitHub
parent de561a55fa
commit 9587dac9c1
6 changed files with 18 additions and 8 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/config": minor
"pnpm": minor
---
Changed default values: `optimisticRepeatInstall` is now `true` and `verifyDepsBeforeRun` is now `install`.

View File

@@ -184,7 +184,7 @@ export async function getConfig (opts: {
'hoist-workspace-packages': true,
'ignore-workspace-cycles': false,
'ignore-workspace-root-check': false,
'optimistic-repeat-install': false,
'optimistic-repeat-install': true,
optional: true,
'init-package-manager': true,
'init-type': 'module',
@@ -222,7 +222,7 @@ export async function getConfig (opts: {
'unsafe-perm': npmDefaults['unsafe-perm'],
'use-beta-cli': false,
userconfig: npmDefaults.userconfig,
'verify-deps-before-run': false,
'verify-deps-before-run': 'install',
'verify-store-integrity': true,
'workspace-concurrency': getDefaultWorkspaceConcurrency(),
'workspace-prefix': opts.workspaceDir,

View File

@@ -240,7 +240,7 @@ test('the list of ignored builds is preserved after a repeat install', async ()
const project = prepare({})
execPnpmSync(['add', '@pnpm.e2e/pre-and-postinstall-scripts-example@1.0.0', 'esbuild@0.25.0', '--config.optimistic-repeat-install=false'])
const result = execPnpmSync(['install'])
const result = execPnpmSync(['install', '--config.optimistic-repeat-install=false'])
// The warning is printed on repeat install too
expect(result.stdout.toString()).toContain('Ignored build scripts:')

View File

@@ -23,10 +23,10 @@ describe('pnpm install --yes', () => {
}
test('prompts without --yes flag', () => {
expect(() => execPnpmSync(['install'], execPnpmOpts)).toThrow('Aborted removal of modules directory due to no TTY')
expect(() => execPnpmSync(['install', '--config.optimistic-repeat-install=false'], execPnpmOpts)).toThrow('Aborted removal of modules directory due to no TTY')
})
test('skips prompt when --yes is passed', () => {
expect(() => execPnpmSync(['install', '--yes'], execPnpmOpts)).not.toThrow()
expect(() => execPnpmSync(['install', '--yes', '--config.optimistic-repeat-install=false'], execPnpmOpts)).not.toThrow()
})
})

View File

@@ -1724,6 +1724,7 @@ test('run --stream should prefix with dir name', async () => {
const result = execPnpmSync([
'--stream',
'--config.verify-deps-before-run=false',
'--filter',
'alfa',
'--filter',
@@ -1749,6 +1750,7 @@ packages/beta test: OK`
)
const singleResult = execPnpmSync([
'--stream',
'--config.verify-deps-before-run=false',
'--filter',
'alfa',
'run',
@@ -1805,6 +1807,7 @@ test('run --reporter-hide-prefix should hide prefix', async () => {
const result = execPnpmSync([
'--stream',
'--reporter-hide-prefix',
'--config.verify-deps-before-run=false',
'--filter',
'alfa',
'--filter',
@@ -1831,6 +1834,7 @@ packages/beta test: Done`
const singleResult = execPnpmSync([
'--stream',
'--reporter-hide-prefix',
'--config.verify-deps-before-run=false',
'--filter',
'alfa',
'run',

View File

@@ -20,7 +20,7 @@ test('run -r: pass the args to the command that is specified in the build script
fs.writeFileSync('project/args.json', '[]', 'utf8')
fs.writeFileSync('project/recordArgs.js', RECORD_ARGS_FILE, 'utf8')
await execPnpm(['run', '-r', '--config.enable-pre-post-scripts', 'foo', 'arg', '--flag=true'])
await execPnpm(['run', '-r', '--config.enable-pre-post-scripts', '--config.verify-deps-before-run=false', 'foo', 'arg', '--flag=true'])
const { default: args } = await import(path.resolve('project/args.json'))
expect(args).toStrictEqual([
@@ -95,7 +95,7 @@ test('recursive test: pass the args to the command that is specified in the buil
},
}])
const result = execPnpmSync(['-r', 'test', 'arg', '--flag=true'])
const result = execPnpmSync(['--config.verify-deps-before-run=false', '-r', 'test', 'arg', '--flag=true'])
expect((result.stdout as Buffer).toString('utf8')).toMatch(
process.platform === 'win32' ? /ts-node test "arg" "--flag=true"/ : /ts-node test arg --flag=true/
@@ -132,7 +132,7 @@ test('silent run only prints the output of the child process', async () => {
},
})
const result = execPnpmSync(['run', '--silent', 'hi'])
const result = execPnpmSync(['run', '--silent', '--config.verify-deps-before-run=false', 'hi'])
expect(result.stdout.toString().trim()).toBe('hi')
})