Skip to content

Commit 899bf25

Browse files
committed
test(snap): add pnpm v11 snap tests for command adaptation coverage (#1289)
Add 26 snap test cases for `pnpm@11.0.6` (latest stable v11), mirroring the existing pnpm10 test suite, to validate `vp`'s command-adaptation layer against pnpm v11. ## Coverage New `snap-tests-global/*-pnpm11` fixtures for: add, cache, config, dedupe, dlx, link, list, outdated, owner, pack, prune, publish, remove, unlink, update, view, vpx, why, dev-engines-runtime — plus workspace variants for add/list/outdated/pack/remove/update/why. ## pnpm v11 compatibility findings - **`cache`,** **`dlx`,** **`owner`,** **`view`,** **`vpx`** — output identical to pnpm v10. - **`add`,** **`install`,** **`link`** — now report `packageManagerDependencies` (`@pnpm/exe`, `pnpm`) as part of install output; captured in snapshots. - **`why`** — output format restructured from tree-based to flat; captured in snapshots. - **`publish --dry-run`** — pnpm v11 no longer delegates to npm; minor output diff captured. - **`unlink`** **(workaround applied)** — pnpm v11 now runs a reconciling install after removing the override from `pnpm-workspace.yaml`. Under `CI=true` this defaults to `--frozen-lockfile` and fails with `ERR_PNPM_LOCKFILE_CONFIG_MISMATCH`. Fix: snap tests pass `-- --no-frozen-lockfile` to `vp unlink`. - **`config`** **at project scope (workaround applied)** — pnpm v11 moved project config from `.npmrc` into `pnpm-workspace.yaml`, which only accepts camelCase keys. Test key renamed to `vitePlusPmConfigTestKey`. - **`dev-engines-runtime`** — bumped pinned Node.js to `22.22.2` to satisfy vp's current minimum (`^20.19.0 || >=22.12.0`). - **`prune`** — skipped on `win32` (platform-specific output instability, matches other tests). Global install is not affected — `vp install -g` already forces npm. ## RFC updates pnpm v11 is now stable, so the support matrix in 7 RFCs (`add-remove`, `dedupe`, `install`, `link-unlink`, `outdated`, `update`, `why`) lists `pnpm@11.x` as supported (no WIP marker). The `link-unlink` entry retains the `-- --no-frozen-lockfile` note for CI usage. ## Test plan - [x] `pnpm -F vite-plus snap-test-global pnpm11` — all 26 cases pass with clean exit codes - [x] `cargo test -p vite_install --lib commands::unlink` — unit tests still pass - [x] CI green on all platforms
1 parent 0901785 commit 899bf25

106 files changed

Lines changed: 3367 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "command-add-pnpm11-with-workspace",
3+
"version": "1.0.0",
4+
"packageManager": "pnpm@11.0.6"
5+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"name": "app"
3+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "@vite-plus-test/utils",
3+
"version": "1.0.0",
4+
"private": true
5+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
packages:
2+
- packages/*
Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
> vp add testnpm2 -D -w && cat package.json # should add package to workspace root
2+
Progress: resolved <variable>, reused <variable>, downloaded <variable>, added <variable>, done
3+
4+
devDependencies:
5+
+ testnpm2 ^1.0.1
6+
7+
Packages: +<variable>
8+
+<repeat>
9+
Done in <variable>ms using pnpm v<semver>
10+
{
11+
"name": "command-add-pnpm11-with-workspace",
12+
"version": "1.0.0",
13+
"packageManager": "pnpm@<semver>",
14+
"devDependencies": {
15+
"testnpm2": "^1.0.1"
16+
}
17+
}
18+
19+
> vp add @vite-plus-test/utils --workspace && cat package.json # should add @vite-plus-test/utils to workspace root
20+
Progress: resolved <variable>, reused <variable>, downloaded <variable>, added <variable>, done
21+
22+
dependencies:
23+
+ @vite-plus-test/utils workspace:*
24+
25+
Already up to date
26+
Done in <variable>ms using pnpm v<semver>
27+
{
28+
"name": "command-add-pnpm11-with-workspace",
29+
"version": "1.0.0",
30+
"packageManager": "pnpm@<semver>",
31+
"devDependencies": {
32+
"testnpm2": "^1.0.1"
33+
},
34+
"dependencies": {
35+
"@vite-plus-test/utils": "workspace:*"
36+
}
37+
}
38+
39+
> vp add testnpm2 test-vite-plus-install@1.0.0 --filter app && cat package.json packages/app/package.json packages/utils/package.json # should add packages to packages/app
40+
Progress: resolved <variable>, reused <variable>, downloaded <variable>, added <variable>, done
41+
. | +1 +<repeat>
42+
Done in <variable>ms using pnpm v<semver>
43+
{
44+
"name": "command-add-pnpm11-with-workspace",
45+
"version": "1.0.0",
46+
"packageManager": "pnpm@<semver>",
47+
"devDependencies": {
48+
"testnpm2": "^1.0.1"
49+
},
50+
"dependencies": {
51+
"@vite-plus-test/utils": "workspace:*"
52+
}
53+
}
54+
{
55+
"name": "app",
56+
"dependencies": {
57+
"test-vite-plus-install": "1.0.0",
58+
"testnpm2": "^1.0.1"
59+
}
60+
}
61+
{
62+
"name": "@vite-plus-test/utils",
63+
"version": "1.0.0",
64+
"private": true
65+
}
66+
67+
> vp add @vite-plus-test/utils --workspace --filter app && cat package.json packages/app/package.json packages/utils/package.json # should add @vite-plus-test/utils to packages/app
68+
Progress: resolved <variable>, reused <variable>, downloaded <variable>, added <variable>, done
69+
Done in <variable>ms using pnpm v<semver>
70+
{
71+
"name": "command-add-pnpm11-with-workspace",
72+
"version": "1.0.0",
73+
"packageManager": "pnpm@<semver>",
74+
"devDependencies": {
75+
"testnpm2": "^1.0.1"
76+
},
77+
"dependencies": {
78+
"@vite-plus-test/utils": "workspace:*"
79+
}
80+
}
81+
{
82+
"name": "app",
83+
"dependencies": {
84+
"@vite-plus-test/utils": "workspace:*",
85+
"test-vite-plus-install": "1.0.0",
86+
"testnpm2": "^1.0.1"
87+
}
88+
}
89+
{
90+
"name": "@vite-plus-test/utils",
91+
"version": "1.0.0",
92+
"private": true
93+
}
94+
95+
> vp add -E testnpm2 test-vite-plus-install --filter "*" && cat package.json packages/app/package.json packages/utils/package.json # should add testnpm2 test-vite-plus-install to all packages except workspace root
96+
Progress: resolved <variable>, reused <variable>, downloaded <variable>, added <variable>, done
97+
Done in <variable>ms using pnpm v<semver>
98+
{
99+
"name": "command-add-pnpm11-with-workspace",
100+
"version": "1.0.0",
101+
"packageManager": "pnpm@<semver>",
102+
"devDependencies": {
103+
"testnpm2": "^1.0.1"
104+
},
105+
"dependencies": {
106+
"@vite-plus-test/utils": "workspace:*",
107+
"test-vite-plus-install": "1.0.0"
108+
}
109+
}
110+
{
111+
"name": "app",
112+
"dependencies": {
113+
"@vite-plus-test/utils": "workspace:*",
114+
"test-vite-plus-install": "1.0.0",
115+
"testnpm2": "^1.0.1"
116+
}
117+
}
118+
{
119+
"name": "@vite-plus-test/utils",
120+
"version": "1.0.0",
121+
"private": true,
122+
"dependencies": {
123+
"test-vite-plus-install": "1.0.0",
124+
"testnpm2": "^1.0.1"
125+
}
126+
}
127+
128+
> vp install test-vite-plus-package@1.0.0 --filter "*" --workspace-root --save-catalog && cat package.json packages/app/package.json packages/utils/package.json pnpm-workspace.yaml # should install packages alias for add command
129+
. | +1 +<repeat>
130+
Progress: resolved <variable>, reused <variable>, downloaded <variable>, added <variable>, done
131+
Done in <variable>ms using pnpm v<semver>
132+
{
133+
"name": "command-add-pnpm11-with-workspace",
134+
"version": "1.0.0",
135+
"packageManager": "pnpm@<semver>",
136+
"devDependencies": {
137+
"testnpm2": "^1.0.1"
138+
},
139+
"dependencies": {
140+
"@vite-plus-test/utils": "workspace:*",
141+
"test-vite-plus-install": "1.0.0",
142+
"test-vite-plus-package": "catalog:"
143+
}
144+
}
145+
{
146+
"name": "app",
147+
"dependencies": {
148+
"@vite-plus-test/utils": "workspace:*",
149+
"test-vite-plus-install": "1.0.0",
150+
"test-vite-plus-package": "catalog:",
151+
"testnpm2": "^1.0.1"
152+
}
153+
}
154+
{
155+
"name": "@vite-plus-test/utils",
156+
"version": "1.0.0",
157+
"private": true,
158+
"dependencies": {
159+
"test-vite-plus-install": "1.0.0",
160+
"test-vite-plus-package": "catalog:",
161+
"testnpm2": "^1.0.1"
162+
}
163+
}
164+
packages:
165+
- packages/*
166+
catalog:
167+
test-vite-plus-package: <semver>
168+
169+
> vp add --filter app test-vite-plus-package-optional --save-catalog-name v1 && cat packages/app/package.json pnpm-workspace.yaml # should add with save-catalog-name
170+
Progress: resolved <variable>, reused <variable>, downloaded <variable>, added <variable>, done
171+
. | +1 +<repeat>
172+
Done in <variable>ms using pnpm v<semver>
173+
{
174+
"name": "app",
175+
"dependencies": {
176+
"@vite-plus-test/utils": "workspace:*",
177+
"test-vite-plus-install": "1.0.0",
178+
"test-vite-plus-package": "catalog:",
179+
"test-vite-plus-package-optional": "catalog:v1",
180+
"testnpm2": "^1.0.1"
181+
}
182+
}
183+
packages:
184+
- packages/*
185+
catalog:
186+
test-vite-plus-package: <semver>
187+
catalogs:
188+
v1:
189+
test-vite-plus-package-optional: ^1.0.0
190+
191+
> vp add --filter=./packages/utils test-vite-plus-package-optional -O --save-catalog-name v2 && cat packages/utils/package.json pnpm-workspace.yaml # should add other with save-catalog-name
192+
Progress: resolved <variable>, reused <variable>, downloaded <variable>, added <variable>, done
193+
Done in <variable>ms using pnpm v<semver>
194+
{
195+
"name": "@vite-plus-test/utils",
196+
"version": "1.0.0",
197+
"private": true,
198+
"dependencies": {
199+
"test-vite-plus-install": "1.0.0",
200+
"test-vite-plus-package": "catalog:",
201+
"testnpm2": "^1.0.1"
202+
},
203+
"optionalDependencies": {
204+
"test-vite-plus-package-optional": "catalog:v2"
205+
}
206+
}
207+
packages:
208+
- packages/*
209+
catalog:
210+
test-vite-plus-package: <semver>
211+
catalogs:
212+
v1:
213+
test-vite-plus-package-optional: ^1.0.0
214+
v2:
215+
test-vite-plus-package-optional: ^1.0.0
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"ignoredPlatforms": ["win32"],
3+
"commands": [
4+
"vp add testnpm2 -D -w && cat package.json # should add package to workspace root",
5+
"vp add @vite-plus-test/utils --workspace && cat package.json # should add @vite-plus-test/utils to workspace root",
6+
"vp add testnpm2 test-vite-plus-install@1.0.0 --filter app && cat package.json packages/app/package.json packages/utils/package.json # should add packages to packages/app",
7+
"vp add @vite-plus-test/utils --workspace --filter app && cat package.json packages/app/package.json packages/utils/package.json # should add @vite-plus-test/utils to packages/app",
8+
"vp add -E testnpm2 test-vite-plus-install --filter \"*\" && cat package.json packages/app/package.json packages/utils/package.json # should add testnpm2 test-vite-plus-install to all packages except workspace root",
9+
"vp install test-vite-plus-package@1.0.0 --filter \"*\" --workspace-root --save-catalog && cat package.json packages/app/package.json packages/utils/package.json pnpm-workspace.yaml # should install packages alias for add command",
10+
"vp add --filter app test-vite-plus-package-optional --save-catalog-name v1 && cat packages/app/package.json pnpm-workspace.yaml # should add with save-catalog-name",
11+
"vp add --filter=./packages/utils test-vite-plus-package-optional -O --save-catalog-name v2 && cat packages/utils/package.json pnpm-workspace.yaml # should add other with save-catalog-name"
12+
]
13+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "command-add-pnpm11",
3+
"version": "1.0.0",
4+
"packageManager": "pnpm@11.0.6"
5+
}

0 commit comments

Comments
 (0)