Please provide the environment you discovered this bug in.
@analogjs/vite-plugin-angular: 2.5.1 (still present on beta, 2.6.1-beta.2)
@analogjs/vitest-angular: 2.5.1
vite: 8.x
vitest: 4.x
node: 24
OS: any
Which area/package is the issue in?
vite-plugin-angular
Description
isTestWatchMode() in packages/vite-plugin-angular/src/lib/angular-vite-plugin.ts looks for a --run flag in argv to decide between a one-shot run and watch mode. It does not know about the vitest run subcommand form, so vitest run (common in CI scripts and nx setups) falls through to return true and the plugin stays in watch mode.
Its result is OR-ed into testWatchMode in configResolved, so nothing later corrects it.
Impact is speed only, not correctness: in watch mode the plugin keeps sourceFileCache attached, and any module invalidation during the run (for example a mid-run dep re-optimize) triggers another incremental compilation over the full program roots. One-shot CI runs pay watch-mode recompile cost they should not.
Repro: run any analog vitest project with vitest run (the subcommand, not vitest --run) and check isTestWatchMode() / watch-mode behavior on invalidation.
Please provide the exception or error you saw
No error. Extra recompiles / slower one-shot runs only.
Other information
Suggested fix: also treat an exact run argument as a one-shot run. Watch cases started by nx still win through the existing OR with config.server.watch in configResolved. I have a fix with tests ready and will open a PR.
I would be willing to submit a PR to fix this issue
Yes
Please provide the environment you discovered this bug in.
Which area/package is the issue in?
vite-plugin-angular
Description
isTestWatchMode()inpackages/vite-plugin-angular/src/lib/angular-vite-plugin.tslooks for a--runflag in argv to decide between a one-shot run and watch mode. It does not know about thevitest runsubcommand form, sovitest run(common in CI scripts and nx setups) falls through toreturn trueand the plugin stays in watch mode.Its result is OR-ed into
testWatchModeinconfigResolved, so nothing later corrects it.Impact is speed only, not correctness: in watch mode the plugin keeps
sourceFileCacheattached, and any module invalidation during the run (for example a mid-run dep re-optimize) triggers another incremental compilation over the full program roots. One-shot CI runs pay watch-mode recompile cost they should not.Repro: run any analog vitest project with
vitest run(the subcommand, notvitest --run) and checkisTestWatchMode()/ watch-mode behavior on invalidation.Please provide the exception or error you saw
Other information
Suggested fix: also treat an exact
runargument as a one-shot run. Watch cases started by nx still win through the existing OR withconfig.server.watchinconfigResolved. I have a fix with tests ready and will open a PR.I would be willing to submit a PR to fix this issue
Yes