Skip to content

test(vite-plugin-ngp): check that vitest reruns a spec after a library template edit - #167

Merged
ChristopherPHolder merged 1 commit into
mainfrom
test/vitest-watch-outside-root
Dec 4, 2026
Merged

ChristopherPHolder merged 1 commit into
mainfrom
test/vitest-watch-outside-root

Conversation

@ChristopherPHolder

Copy link
Copy Markdown
Collaborator

#139 made the plugin add each component template outside Vite's root to the watcher, but only the dev server was tested. Under Vitest, that watcher is Vitest's, and it also watches only its root.

How the new test/vitest-watch.test.mjs works:

  1. It builds an app/ with a spec that imports libs/ui/badge.ts, a component outside Vitest's root.
  2. It runs vitest --watch and waits for 1 passed.
  3. It edits libs/ui/badge.html and expects the rerun to fail with Expected: "before" Received: "after".

Checked:

  • It passes 3 runs out of 3, in about 2.5 s.
  • With watcher.add(template) removed from dist/index.js, it fails after the 30 s wait, because no rerun comes.

Docs: Testing ("Watch mode follows edits"), the 4 December changelog fix line, and the Vitest row in docs/design.md.

Closes #147

🤖 Generated with Claude Code

…y template edit

Starts Vitest in its watching mode on an app whose spec imports a component from libs/ui, outside
Vitest's root, edits the component's template, and expects the rerun to fail on the new text.
Without the plugin adding the template to the watcher, no rerun comes.

Closes #147

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ChristopherPHolder

Copy link
Copy Markdown
Collaborator Author

LGTM. I checked:

  • CI is green on 24b3748.
  • The new test passed 3 runs out of 3 locally, in about 2.5 s each.
  • With watcher.add(template) removed from dist/index.js, it fails after the 30 s wait.
  • It merges cleanly onto the current main (91d9f25), and docs:check passes.

@ChristopherPHolder
ChristopherPHolder merged commit 85ce9a4 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.

test(vite-plugin-ngp): check vitest watch mode reruns specs after a library template edit

1 participant