-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: skip over cataloged deps on
pnpm update --latest
- Loading branch information
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -593,4 +593,51 @@ describe('update', () => { | |
packages: { '[email protected]': expect.objectContaining({}) }, | ||
})) | ||
}) | ||
|
||
test('update latest does modify catalog: protocol', async () => { | ||
const { options, projects, readLockfile } = preparePackagesAndReturnObjects([{ | ||
name: 'project1', | ||
dependencies: { | ||
'is-positive': 'catalog:', | ||
}, | ||
}]) | ||
|
||
const catalogs = { | ||
default: { 'is-positive': '1.0.0' }, | ||
} | ||
|
||
const mutateOpts = { | ||
...options, | ||
lockfileOnly: true, | ||
catalogs, | ||
} | ||
|
||
await mutateModules(installProjects(projects), mutateOpts) | ||
|
||
// Sanity check that the is-positive dependency is installed on the older | ||
// requested version. | ||
expect(readLockfile().catalogs.default).toEqual({ | ||
'is-positive': { specifier: '1.0.0', version: '1.0.0' }, | ||
}) | ||
|
||
const updatedManifest = await addDependenciesToPackage( | ||
projects['project1' as ProjectId], | ||
['is-positive'], | ||
{ | ||
...mutateOpts, | ||
allowNew: false, | ||
update: true, | ||
updateToLatest: true, | ||
}) | ||
|
||
// Expecting the manifest to remain unchanged. | ||
expect(updatedManifest).toEqual({ | ||
name: 'project1', | ||
dependencies: { | ||
'is-positive': 'catalog:', | ||
}, | ||
}) | ||
|
||
expect(Object.keys(readLockfile().snapshots)).toEqual(['[email protected]']) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters