Skip to content

test(create-ngp): run the app template's spec on jsdom and in chromium under vp test - #137

Merged
ChristopherPHolder merged 1 commit into
mainfrom
test/vite-plus-browser-nx
Dec 4, 2026
Merged

ChristopherPHolder merged 1 commit into
mainfrom
test/vite-plus-browser-nx

Conversation

@ChristopherPHolder

Copy link
Copy Markdown
Collaborator

Closes #133.

What changed

  • CI test. packages/create-ngp/test/app.test.mjs gets one new test after the existing Vite+ run of the app template. It reuses that migrated app and does what a user would: vp add -D jsdom @vitest/browser-playwright playwright, then writes a vitest.config.ts with a jsdom project and a browser (Chromium) project and runs vp test run. It asserts that the spec passed in both projects, then runs vp check. Versions: @vitest/browser-playwright uses the Vitest that Vite+ bundles (read from vite-plus/package.json, 5.1.0 in 1.6.0). playwright and jsdom use the playground's versions, so the app uses the Chromium CI already downloads for the playground's browser project. No new CI step, only a comment in ci.yml.
  • No plugin bugs found. Both modes work unchanged under Vite+.
  • Docs
    • vite-plus.md: new section Specs on jsdom and in a browser. Under Vite+ the setup file imports from vite-plus/test and the provider from vite-plus/test/browser-playwright; the section also says what vp migrate does to an app that already has these setups. New section In an Nx workspace. The toolchain table now mentions jsdom and browser mode, and vp pack moves out of Limits into a table row that points to Status. The Limits bullet shrinks to "an Nx workspace with libraries".
    • testing.md: one pointer each in the jsdom and browser-mode setups.
    • status.md: the Vite+ row.
    • nx.md: its claim that @nx/vite's target inference is untested is no longer true, so I corrected it.
    • Changelog: a Vite+ entry under 4 December 2026.

How it was verified

Vite+ 1.6.0, macOS, Node 26.

  • Full create-ngp app suite (node --test test/app.test.mjs, under the shared lock): 5/5 pass. The new test took 4.6 s (4.8 s on a second run), on top of 11.4 s and 12.9 s for the two existing Vite+ tests:
    ✔ app: passes its spec on jsdom and in Chromium under vp test (4640.035542ms)
    
  • By hand, on a scaffolded app after vp migrate: a probe spec confirmed where each mode runs. Browser mode reported HeadlessChrome/158 and ngServerMode false; jsdom reported jsdom/30.1.2.
  • vp migrate on an app that already had the Testing page's three projects (server, jsdom, browser with @vitest/browser-playwright@5.0.4): migrate rewrote the import to vite-plus/test/browser-playwright and moved the provider and vitest to 5.1.0 in the catalog. vp check passed, and so did all three projects under vp test run. With the provider left at 5.0.4 the spec still passes, but pnpm reports a peer issue.
  • Nx (manual, in a scratch dir): a new Nx 24.1 workspace (create-nx-workspace --preset=apps --pm=pnpm) with @nx/vite and @nx/vitest, and the app template under packages/web, then vp migrate at the root.
    • Before Vite+: nx build, nx test and nx serve work.
    • After vp migrate, these work: vp build, vp test and vp dev in the app, vp run -r build, vp check after --fix, nx build, nx test, nx dev, and nx run @org/web:test-ci--src/app/app.spec.ts. A template error fails both vp build and nx build with TS2551.
    • nx serve fails with /bin/sh: vite: command not found: @nx/vite infers it as the command vite, and @voidzero-dev/vite-plus-core has no vite bin. Adding "serve": "vp dev" to the app's scripts fixes it (verified). Documented, not worked around in the plugin.
    • Not Vite+-specific, also documented: Nx caches neither build nor test (the template's package.json scripts win over the inferred targets, and scripts aren't cached unless targetDefaults says so; verified that cache: true gives 1/1 hits). @nx/js's inferred typecheck fails with TS5069 on the template's tsconfigs.
  • pnpm docs:check passes (16 options, 18 pages, 415 links). pnpm site:build passes.

Left open

  • No Nx workspace with Angular libraries has been run under Vite+ (still in Limits). @nx/vite's executors haven't been tried either.
  • Browser mode on Firefox and WebKit, and happy-dom, remain untried, with or without Vite+.
  • Nx stays a manual check per the task, so no decision entry was added.

🤖 Generated with Claude Code

…m under vp test

Under Vite+ the provider comes from vite-plus/test/browser-playwright, at the Vitest version Vite+
bundles. The Vite+ page documents that setup, what one app in an Nx workspace does under Vite+,
and moves vp pack out of its limits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ChristopherPHolder
ChristopherPHolder force-pushed the test/vite-plus-browser-nx branch from 165c1a0 to 22f0296 Compare December 4, 2026 04:47
@ChristopherPHolder

Copy link
Copy Markdown
Collaborator Author

LGTM. Checked: the new test reuses the already-migrated app (no extra install), adds jsdom + browser-mode projects with the provider from vite-plus/test/browser-playwright and Vitest's bundled version, and reuses the playground's Chromium (no new CI step). Fixed on the branch: (1) CI forces colour, so Vitest printed the project as a badge, not |jsdom|, and the regex missed — output is now stripped of ANSI codes and matches both forms; (2) main's ngp-generate step adds specs to the same app, so 2 passed became no failures. Locally with FORCE_COLOR=1: create-ngp app tests 7/7. Docs rebased onto #138's Limits. Speed: ~5 s added to the create-ngp suite, no plugin change. CI green on 22f0296.

@ChristopherPHolder
ChristopherPHolder merged commit 91d9f25 into main Dec 4, 2026
2 checks passed
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.

Try Vitest browser mode, jsdom and Nx under Vite+, and move vp pack out of its limits

1 participant