Skip to content

fix(vite-plugin-angular): treat the vitest run command as a single run instead of watch mode#2374

Merged
brandonroberts merged 1 commit into
analogjs:betafrom
fyvfyv:fix/vitest-run-watch-detection
Jun 11, 2026
Merged

fix(vite-plugin-angular): treat the vitest run command as a single run instead of watch mode#2374
brandonroberts merged 1 commit into
analogjs:betafrom
fyvfyv:fix/vitest-run-watch-detection

Conversation

@fyvfyv

@fyvfyv fyvfyv commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

PR Checklist

isTestWatchMode() only detects the --run flag. The vitest run subcommand form (common in CI scripts and nx) falls through to return true, so one-shot runs keep watch-mode caches and pay extra incremental recompiles when modules are invalidated mid-run (for example by a dep re-optimize).

Closes #2372

Affected scope

  • Primary scope: vite-plugin-angular
  • Secondary scopes: none

Recommended merge strategy for maintainer [optional]

  • Squash merge
  • Rebase merge
  • Other

Commit preservation note [optional]

n/a

What is the new behavior?

isTestWatchMode() also treats an exact run argument as a one-shot run. The check uses exact match (args.includes('run')), so file filters like src/run-helpers.spec.ts are not affected (covered by a test). Watch runs started by nx still resolve to watch mode through the existing OR with config.server.watch in configResolved.

Test plan

  • nx format:check
  • pnpm build (nx build-package vite-plugin-angular, tsc, no errors)
  • pnpm test (full workspace green; nx test vite-plugin-angular: 624 passed, 3 skipped)
  • Manual verification: new unit tests for isTestWatchMode(['run']) and isTestWatchMode(['run', 'src/example.spec.ts']) fail on the old code and pass with the fix

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Speed-only fix; no change to compile output.

@fyvfyv fyvfyv requested a review from brandonroberts as a code owner June 10, 2026 22:23
@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 79a5b496-fe5a-48c1-9213-fdc2cd507069

📥 Commits

Reviewing files that changed from the base of the PR and between 744b684 and f349799.

📒 Files selected for processing (2)
  • packages/vite-plugin-angular/src/lib/angular-vite-plugin.spec.ts
  • packages/vite-plugin-angular/src/lib/angular-vite-plugin.ts

📝 Walkthrough

Walkthrough

The PR fixes a bug in the Vitest plugin where the run subcommand form (vitest run) was incorrectly treated as watch mode. The isTestWatchMode helper now detects the plain run argument in CLI args with args.includes('run'), replacing logic that only looked for the --run flag. This prevents unnecessary module invalidation and recompiles during one-shot CI runs. Tests were added to validate both subcommand detection and correct file path handling.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title follows Conventional Commit style with correct scope (vite-plugin-angular) and clearly describes the fix: treating vitest run command as non-watch mode.
Description check ✅ Passed The PR description is comprehensive and directly related to the changeset, explaining the bug, the fix, test coverage, and verification steps performed.
Linked Issues check ✅ Passed The PR fully addresses #2372: it implements detection of the exact 'run' argv argument, preserves watch-mode detection via config.server.watch, includes tests, and maintains non-breaking behavior.
Out of Scope Changes check ✅ Passed All changes are scoped to the isTestWatchMode detection logic and related tests in vite-plugin-angular, directly addressing the linked issue with no extraneous modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@netlify

netlify Bot commented Jun 10, 2026

Copy link
Copy Markdown

Deploy Preview for analog-blog ready!

Name Link
🔨 Latest commit f349799
🔍 Latest deploy log https://app.netlify.com/projects/analog-blog/deploys/6a29e3f3274af20008b789ee
😎 Deploy Preview https://deploy-preview-2374--analog-blog.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Jun 10, 2026

Copy link
Copy Markdown

Deploy Preview for analog-app ready!

Name Link
🔨 Latest commit f349799
🔍 Latest deploy log https://app.netlify.com/projects/analog-app/deploys/6a29e3f326d9630008ed7576
😎 Deploy Preview https://deploy-preview-2374--analog-app.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Jun 10, 2026

Copy link
Copy Markdown

Deploy Preview for analog-docs ready!

Name Link
🔨 Latest commit f349799
🔍 Latest deploy log https://app.netlify.com/projects/analog-docs/deploys/6a29e3f5bfdc840008632332
😎 Deploy Preview https://deploy-preview-2374--analog-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@brandonroberts brandonroberts merged commit 931200a into analogjs:beta Jun 11, 2026
20 of 21 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.

vite-plugin-angular: vitest run is treated as watch mode (only the --run flag is detected)

2 participants