mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-10 18:18:56 -04:00
refactor: error message on out of date lockfile
This commit is contained in:
5
.changeset/hot-lies-rescue.md
Normal file
5
.changeset/hot-lies-rescue.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/core": patch
|
||||
---
|
||||
|
||||
When the lockfile is not up to date make it clear what `package.json` is out of sync.
|
||||
@@ -441,7 +441,7 @@ Note that in CI environments, this setting is enabled by default.`,
|
||||
|
||||
throw new PnpmError('OUTDATED_LOCKFILE',
|
||||
`Cannot install with "frozen-lockfile" because ${WANTED_LOCKFILE} is not up to date with ` +
|
||||
path.relative(opts.lockfileDir, path.join(rootDir, 'package.json')), {
|
||||
path.join('<ROOT>', path.relative(opts.lockfileDir, path.join(rootDir, 'package.json'))), {
|
||||
hint: `Note that in CI environments this setting is true by default. If you still need to run install in such cases, use "pnpm install --no-frozen-lockfile"
|
||||
|
||||
Failure reason:
|
||||
|
||||
@@ -28,7 +28,7 @@ test(`frozen-lockfile: installation fails if specs in package.json don't match t
|
||||
'is-positive': '^3.1.0',
|
||||
},
|
||||
}, testDefaults({ frozenLockfile: true }))
|
||||
).rejects.toThrow(`Cannot install with "frozen-lockfile" because ${WANTED_LOCKFILE} is not up to date with package.json`)
|
||||
).rejects.toThrow(`Cannot install with "frozen-lockfile" because ${WANTED_LOCKFILE} is not up to date with ${path.join('<ROOT>', 'package.json')}`)
|
||||
})
|
||||
|
||||
test(`frozen-lockfile+hoistPattern: installation fails if specs in package.json don't match the ones in ${WANTED_LOCKFILE}`, async () => {
|
||||
@@ -46,7 +46,7 @@ test(`frozen-lockfile+hoistPattern: installation fails if specs in package.json
|
||||
'is-positive': '^3.1.0',
|
||||
},
|
||||
}, testDefaults({ frozenLockfile: true, hoistPattern: '*' }))
|
||||
).rejects.toThrow(`Cannot install with "frozen-lockfile" because ${WANTED_LOCKFILE} is not up to date with package.json`)
|
||||
).rejects.toThrow(`Cannot install with "frozen-lockfile" because ${WANTED_LOCKFILE} is not up to date with ${path.join('<ROOT>', 'package.json')}`)
|
||||
})
|
||||
|
||||
test(`frozen-lockfile: fail on a shared ${WANTED_LOCKFILE} that does not satisfy one of the package.json files`, async () => {
|
||||
@@ -97,7 +97,7 @@ test(`frozen-lockfile: fail on a shared ${WANTED_LOCKFILE} that does not satisfy
|
||||
|
||||
await expect(
|
||||
mutateModules(projects, testDefaults({ frozenLockfile: true, allProjects: [project1, project2] }))
|
||||
).rejects.toThrow(`Cannot install with "frozen-lockfile" because ${WANTED_LOCKFILE} is not up to date with p1${path.sep}package.json`)
|
||||
).rejects.toThrow(`Cannot install with "frozen-lockfile" because ${WANTED_LOCKFILE} is not up to date with ${path.join('<ROOT>', 'p1/package.json')}`)
|
||||
})
|
||||
|
||||
test(`frozen-lockfile: should successfully install when ${WANTED_LOCKFILE} is available`, async () => {
|
||||
|
||||
Reference in New Issue
Block a user