Skip to content

Commit f16a0f8

Browse files
committed
test(snap): work around pnpm v11 unlink frozen-lockfile error
pnpm v11 made `pnpm unlink` actually perform a reconciling install after removing the override from pnpm-workspace.yaml. Under CI=true the install defaults to --frozen-lockfile, which fails with ERR_PNPM_LOCKFILE_CONFIG_MISMATCH because the lockfile still carries the override that was just removed. Pass `--no-frozen-lockfile` through to pnpm in the two affected snap tests and note the requirement in the RFC's supported-versions list. Also adds pnpm@11.x entries to the Test Package Manager Versions sections of 7 RFCs covering add/remove/install/update/outdated/why/ dedupe/link-unlink.
1 parent 7b6892d commit f16a0f8

5 files changed

Lines changed: 62 additions & 14 deletions

File tree

packages/cli/snap-tests-global/command-link-pnpm11/snap.txt

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,43 @@ importers:
8585
specifier: link:../test-lib-pnpm
8686
version: link:../test-lib-pnpm
8787

88-
[1]> vp unlink ../test-lib-pnpm && vp unlink testnpm2 && cat package.json pnpm-lock.yaml # should unlink the package
88+
> vp unlink ../test-lib-pnpm -- --no-frozen-lockfile && vp unlink testnpm2 -- --no-frozen-lockfile && cat package.json pnpm-lock.yaml # should unlink the package (pnpm v11 requires --no-frozen-lockfile under CI=true to avoid ERR_PNPM_LOCKFILE_CONFIG_MISMATCH)
8989
Already up to date
90-
 ERR_PNPM_LOCKFILE_CONFIG_MISMATCH  Cannot proceed with the frozen installation. The current "overrides" configuration doesn't match the value found in the lockfile
90+
testnpm2 is linked to <cwd>/node_modules from <cwd>/../test-lib-pnpm
91+
Already up to date
92+
Progress: resolved <variable>, reused <variable>, downloaded <variable>, added <variable>, done
93+
94+
dependencies:
95+
- testnpm2 <semver>
96+
+ testnpm2 <semver>
97+
98+
{
99+
"name": "command-link-pnpm11",
100+
"version": "1.0.0",
101+
"dependencies": {
102+
"testnpm2": "*"
103+
},
104+
"packageManager": "pnpm@<semver>
105+
}
106+
lockfileVersion: '9.0'
107+
108+
settings:
109+
autoInstallPeers: true
110+
excludeLinksFromLockfile: false
111+
112+
importers:
113+
114+
.:
115+
dependencies:
116+
testnpm2:
117+
specifier: '*'
118+
version: <semver>
119+
120+
packages:
121+
122+
testnpm2@<semver>:
123+
resolution: {integrity: sha512-<hash>
124+
125+
snapshots:
91126

92-
Update your lockfile using "pnpm install --no-frozen-lockfile"
127+
testnpm2@<semver>: {}

packages/cli/snap-tests-global/command-link-pnpm11/steps.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
"mkdir -p ../test-lib-pnpm && echo '{\"name\": \"testnpm2\", \"version\": \"1.0.0\"}' > ../test-lib-pnpm/package.json # create test library",
77
"vp link ../test-lib-pnpm && cat package.json pnpm-lock.yaml # should link local directory",
88
"vp ln ../test-lib-pnpm && cat package.json pnpm-lock.yaml # should work with ln alias",
9-
"vp unlink ../test-lib-pnpm && vp unlink testnpm2 && cat package.json pnpm-lock.yaml # should unlink the package"
9+
"vp unlink ../test-lib-pnpm -- --no-frozen-lockfile && vp unlink testnpm2 -- --no-frozen-lockfile && cat package.json pnpm-lock.yaml # should unlink the package (pnpm v11 requires --no-frozen-lockfile under CI=true to avoid ERR_PNPM_LOCKFILE_CONFIG_MISMATCH)"
1010
]
1111
}

packages/cli/snap-tests-global/command-unlink-pnpm11/snap.txt

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,29 @@ dependencies:
2929
}
3030
}
3131

32-
[1]> vp unlink unlink-test-lib && cat package.json # should unlink the package
33-
 ERR_PNPM_LOCKFILE_CONFIG_MISMATCH  Cannot proceed with the frozen installation. The current "overrides" configuration doesn't match the value found in the lockfile
32+
> vp unlink unlink-test-lib -- --no-frozen-lockfile && cat package.json # should unlink the package (pnpm v11 requires --no-frozen-lockfile under CI=true)
33+
Already up to date
3434

35-
Update your lockfile using "pnpm install --no-frozen-lockfile"
35+
{
36+
"name": "command-unlink-pnpm11",
37+
"version": "1.0.0",
38+
"packageManager": "pnpm@<semver>
39+
"dependencies": {
40+
"unlink-test-lib": "link:../unlink-test-lib"
41+
}
42+
}
3643

3744
> vp link ../unlink-test-lib # link again
38-
Lockfile is up to date, resolution step is skipped
3945

4046

41-
[1]> vp unlink && cat package.json # should unlink all packages
42-
 ERR_PNPM_LOCKFILE_CONFIG_MISMATCH  Cannot proceed with the frozen installation. The current "overrides" configuration doesn't match the value found in the lockfile
47+
> vp unlink -- --no-frozen-lockfile && cat package.json # should unlink all packages
48+
Already up to date
4349

44-
Update your lockfile using "pnpm install --no-frozen-lockfile"
50+
{
51+
"name": "command-unlink-pnpm11",
52+
"version": "1.0.0",
53+
"packageManager": "pnpm@<semver>
54+
"dependencies": {
55+
"unlink-test-lib": "link:../unlink-test-lib"
56+
}
57+
}

packages/cli/snap-tests-global/command-unlink-pnpm11/steps.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"vp unlink -h # should show help message",
55
"mkdir -p ../unlink-test-lib && echo '{\"name\": \"unlink-test-lib\", \"version\": \"1.0.0\"}' > ../unlink-test-lib/package.json # create test library",
66
"vp link ../unlink-test-lib && cat package.json # link the library first",
7-
"vp unlink unlink-test-lib && cat package.json # should unlink the package",
7+
"vp unlink unlink-test-lib -- --no-frozen-lockfile && cat package.json # should unlink the package (pnpm v11 requires --no-frozen-lockfile under CI=true)",
88
"vp link ../unlink-test-lib # link again",
9-
"vp unlink && cat package.json # should unlink all packages"
9+
"vp unlink -- --no-frozen-lockfile && cat package.json # should unlink all packages"
1010
]
1111
}

rfcs/link-unlink-package-commands.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ $ vp link
753753

754754
- pnpm@9.x
755755
- pnpm@10.x
756-
- pnpm@11.x [WIP] (unlink currently blocked by `ERR_PNPM_LOCKFILE_CONFIG_MISMATCH`)
756+
- pnpm@11.x [WIP] (pass `-- --no-frozen-lockfile` to `vp unlink` under CI=true; see snap-tests `command-unlink-pnpm11`)
757757
- yarn@1.x
758758
- yarn@4.x
759759
- npm@10.x

0 commit comments

Comments
 (0)