Commit 68ed33b
fix(desktop-windows): name the supported Node version instead of failing silently (#10665)
`pnpm test` in desktop/windows fails 29 test files and 129 tests on a current
Node, with the same code and the same lockfile that is fully green on Node 22.
Nothing in the package says which Node is required: there is no `engines` field
and no `.nvmrc` anywhere in the repo, while all five CI workflows pin
`node-version: 22`. The breakage is therefore invisible in CI and lands only on a
contributor's machine.
The cause is not the tests. Node >= 24 ships its own experimental `localStorage`
global, `undefined` unless `--localstorage-file` is passed, and it takes
precedence over the one jsdom installs. Every `// @vitest-environment jsdom`
suite that touches localStorage then dies on
`Cannot read properties of undefined (reading 'clear')`, which reads like a
broken test rather than a wrong runtime.
Declares the range and enforces it where the symptom appears:
- `engines.node` = `>=22.19.0 <23`. The floor is real, not decorative:
`@earendil-works/pi-ai` declares `engines.node >= 22.19.0`, so an older 22.x
installs and is still unsupported.
- A `pretest` guard that names the required range, the running version, and the
reason, so the first failure is one legible line instead of 129 assertions.
`engine-strict=true` in .npmrc was tried and rejected: it makes pnpm enforce the
engines field of every transitive dependency, a far wider blast radius than this
problem, and it rejected Node 22.16.0 over a dependency's floor while giving no
hint that the test suite itself was fine.
Verification (same tree, same lockfile, only the runtime changed):
Node 26.3.1 pnpm test -> 29 files / 129 tests FAILED (localStorage undefined)
Node 22.23.1 pnpm test -> 523 files / 5037 tests passed, 6 skipped
guard on v26.3.1 -> exit 1, explains the localStorage shadowing
guard on v22.16.0 -> exit 1, explains the >=22.19.0 dependency floor
guard on v22.23.1 -> exit 0 (this is what CI's `node-version: 22` resolves to,
so `pnpm test` in CI keeps passing)
Failure-Class: none
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent 78c8faa commit 68ed33b
2 files changed
Lines changed: 43 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
6 | 9 | | |
7 | 10 | | |
8 | 11 | | |
| |||
34 | 37 | | |
35 | 38 | | |
36 | 39 | | |
| 40 | + | |
37 | 41 | | |
38 | 42 | | |
39 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
0 commit comments