You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The unit-test builder doesn't re-run test suites on changes to non-spec files #32159
Root cause: In packages/angular/build/src/builders/unit-test/runners/vitest/executor.ts, the entryPointToTestFile map only contains .spec.ts files. When non-test files (services, components) change during watch mode, they're not in the map, and getModuleSpecifications() is never called for them — so no dependent tests are re-run.
Proposed fix: In the else branch (when a modified file isn't in the test map), call vitest.getModuleSpecifications() on the absolute output file path. Vitest's module graph correctly traverses backwards to find all dependent test specifications. This is consolidated into a single loop for clarity.
Activity
fix(@angular/build): trigger test re-run on non-spec file changes in …
fix(@angular/build): trigger test re-run on non-spec file changes in …
maruthang commentedon Mar 27, 2026
Hi, I'd like to work on this issue.
Root cause: In
packages/angular/build/src/builders/unit-test/runners/vitest/executor.ts, theentryPointToTestFilemap only contains.spec.tsfiles. When non-test files (services, components) change during watch mode, they're not in the map, andgetModuleSpecifications()is never called for them — so no dependent tests are re-run.Proposed fix: In the
elsebranch (when a modified file isn't in the test map), callvitest.getModuleSpecifications()on the absolute output file path. Vitest's module graph correctly traverses backwards to find all dependent test specifications. This is consolidated into a single loop for clarity.Submitting a PR now.
fix(@angular/build): trigger test re-run on non-spec file changes in …