Skip to content

Fix BL-16525 vp test cannot resolve jsdom under vite-plus bundled runner#8049

Draft
hatton wants to merge 1 commit into
masterfrom
BL-16525-vp-test-jsdom
Draft

Fix BL-16525 vp test cannot resolve jsdom under vite-plus bundled runner#8049
hatton wants to merge 1 commit into
masterfrom
BL-16525-vp-test-jsdom

Conversation

@hatton

@hatton hatton commented Jul 10, 2026

Copy link
Copy Markdown
Member

Fixes BL-16525: bare vp test in src/BloomBrowserUI failed with Cannot find package 'jsdom' (47 errors, no tests run) because vite-plus's bundled vitest in ~/.vite-plus is installed without jsdom, and vitest only gets jsdom via an optional peer dependency that pnpm links when vitest lives in the project.

Fix

  • Add vite-plus: 0.2.2 as an exact devDependency in src/BloomBrowserUI. The global vp binary prefers a project-local vite-plus install over its bundled toolchain, and pnpm peer-links our jsdom@26.1.0 into that install's vitest, so vp test now loads the jsdom environment.
  • Document in ReadMe.md that pnpm test is the canonical test command and why vp test works.

Notes

  • Pinned at 0.2.2 because the repo's 7-day minimumReleaseAge policy blocks 0.2.4 (published 2026-07-08).
  • vp test runs vite-plus's vitest 4.1.9 while pnpm test runs the pinned 4.0.8; both pass the full suite (498 passed / 5 skipped).
  • pnpm peers check gains a few @vitest/browser-* version-skew warnings; browser mode is disabled in vite.config.mts.

🤖 Generated with Claude Code

Devin review


This change is Reviewable

…under vite-plus's bundled runner

https://issues.bloomlibrary.org/youtrack/issue/BL-16525

Add vite-plus 0.2.2 as a devDependency in src/BloomBrowserUI. The global
`vp` binary prefers a project-local vite-plus install over its own bundled
toolchain (per vite-plus's merge-global-and-local-cli RFC). vitest declares
jsdom as an optional peer dependency, so pnpm links the project's
jsdom@26.1.0 into the local install's vitest, letting `vp test` load the
jsdom test environment. vp's bundled vitest in ~/.vite-plus is installed
without jsdom and cannot resolve it at all, which caused every forks
worker to fail ("Cannot find package 'jsdom'", 47 errors, no tests run).

Also document in ReadMe.md that `pnpm test` is the canonical test command
and why `vp test` now works.

Notes:
- vite-plus is pinned at 0.2.2 because the repo's 7-day minimumReleaseAge
  policy (src/BloomBrowserUI/pnpm-workspace.yaml) blocks 0.2.4, published
  2026-07-08.
- `vp test` runs vite-plus's vitest (4.1.9) while `pnpm test` runs the
  project's pinned vitest (4.0.8); both pass.
- `pnpm peers check` gains a few version-skew warnings for the optional
  @vitest/browser-* peers; browser mode is disabled in vite.config.mts.

Tests: full front-end suite green under both runners in this worktree —
`vp test` 498 passed / 5 skipped (46 files; previously 47 errors, no tests),
`pnpm test` 498 passed / 5 skipped. `pnpm install --frozen-lockfile`
confirms the lockfile is in sync.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds vite-plus@0.2.2 as a local devDependency so that the global vp CLI prefers the project-local install, allowing pnpm to peer-link jsdom into vite-plus's bundled vitest and unblocking bare vp test. Documentation is also updated to explain the distinction between pnpm test (canonical) and vp test.

  • package.json: single-line addition of \"vite-plus\": \"0.2.2\" (exact pin, intentionally blocking the newer 0.2.4 due to the repo's 7-day minimumReleaseAge policy).
  • pnpm-lock.yaml: lockfile updated with vite-plus's transitive dependencies; notable side-effects are lightningcss@1.32.0 appearing in vite's resolved peer string (harmless — Vite only uses lightningcss when explicitly configured via css.transformer) and a @vitest/browser-preview@4.1.9 / vitest@4.0.8 version-skew warning (benign — browser mode is disabled in vite.config.mts).

Important Files Changed

Filename Overview
ReadMe.md Adds a paragraph explaining pnpm test is canonical and why vp test now works as a secondary option
src/BloomBrowserUI/package.json Adds vite-plus@0.2.2 as an exact-pinned devDependency to give the local project a vite-plus install that pnpm will peer-link jsdom into
src/BloomBrowserUI/pnpm-lock.yaml Lockfile updated with vite-plus and transitive pull-ins: lightningcss@1.32.0 introduced into vite's peer chain, @vitest/browser-preview@4.1.9 appears in vitest@4.0.8's resolution (version skew, acknowledged in PR), plus @oxfmt/@oxc-project binaries from vite-plus's formatter toolchain

Reviews (1): Last reviewed commit: "Fix BL-16525 `vp test` cannot resolve js..." | Re-trigger Greptile

"vite": "7.1.5",
"vite-plugin-pug": "0.4.1",
"vite-plugin-static-copy": "3.1.3",
"vite-plus": "0.2.2",

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Devin] Investigate: Adding vite-plus pulls in lightningcss as a transitive peer dependency of vite

Adding vite-plus@0.2.2 causes lightningcss@1.32.0 to be resolved as a peer dependency of vite@7.1.5. Previously, vite's resolution string was vite@7.1.5(@types/node@22.9.0)(less@3.13.1)(yaml@2.9.0) and it is now vite@7.1.5(@types/node@22.9.0)(less@3.13.1)(lightningcss@1.32.0)(yaml@2.9.0). While lightningcss is an optional peer dep of vite and this is expected, its presence can change CSS minification behavior in production builds (vite uses lightningcss for CSS minification when it's available). This is dev-only and unlikely to cause issues, but worth being aware of if CSS output changes are observed after this merge.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Claude Fable 5] Assessment: no behavior change expected. Vite only uses lightningcss when explicitly configured (css.transformer: 'lightningcss' or build.cssMinify: 'lightningcss') — mere presence in node_modules does not switch the CSS pipeline. This repo's vite.config.mts sets build.minify: false and never configures lightningcss, so it stays on the default (postcss/esbuild) path. The lockfile resolution-string change is real but inert.

@hatton

hatton commented Jul 10, 2026

Copy link
Copy Markdown
Member Author

[Claude Fable 5] Consulted Devin on 2026-07-10 ~23:05Z up to commit a45cb79. Result: 0 Bugs, 1 Investigate flag (mirrored as an inline thread), 1 Informational (skipped per convention).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant