Repository navigation
chore(frontend): move unit tests to vitest 5.0.1 - #5942
Merged
norman-abramovitz merged 3 commits intoSep 23, 2026
Merged
Conversation
Each inline entry in vitest.config.ts extends a package config that sets test.root to its own directory. Vitest 4 honours that. Vitest 5 does not: an inline project takes the root of the file that declares it, so every package's include of src/**/*.spec.ts resolves from the repo root and matches all 679 specs, and the Angular plugin looks for tsconfig.spec.json at the repo root and compiles no templates. The result under vitest 5 is 486 failing files, mostly "No provider found for ResourceLoader", for any single --project. Setting root on the entry itself fixes that and changes nothing under vitest 4: the full suite gives the same 666 passed and 2 skipped files and 3745 tests before and after. Landing it first keeps the runner bump a pure dependency change.
Replaces dependabot PRs 5939, 5940 and 5941, which bump vitest, @vitest/coverage-v8 and @vitest/ui separately. Vitest 5 peers the other two at exactly its own version, so none of the three is coherent on its own; they move together here. @oxc-project/runtime is added at 0.121.0, the version of the installed oxc-parser. Under vitest 5 the decorator helper for the decorated NgModule in vitest.workspace.setup.ts is emitted as an import of @oxc-project/runtime/helpers/decorate instead of being inlined, and nothing in the tree provided it, so every spec file failed to load. The per-project root added in the previous commit is the other half. With both, the full suite matches vitest 4 exactly: 666 passed and 2 skipped files, 3745 passed and 2 skipped tests. test:coverage runs green and test:ui serves. Angular 22.1 is unaffected: the tests call vitest directly and never go through @angular/build.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces #5939, #5940 and #5941, which bump
vitest,@vitest/coverage-v8and@vitest/uito 5.0.1 separately. Vitest 5 peers the other two at exactly its own version, so none of the three works on its own. They move together here, with the two changes that make the suite run.Why the dependabot PRs fail
Any of them on its own, or all three together, fails in two layers.
Every spec fails to load.
vitest.workspace.setup.tsdeclares a decoratedNgModule. Under vitest 5 the decorator helper is emitted as an import of@oxc-project/runtime/helpers/decorateinstead of being inlined, and nothing in the tree provides that package:Each project runs the whole tree. With the import fixed,
vitest run --project=gitruns 679 files and 486 fail, mostly withNo provider found for ResourceLoader.--projectitself works: every one of those files is labelled|git|. The problem is that thegitproject collects the whole tree. Each inline entry invitest.config.tsextends a package config that setstest.rootto its own directory. Vitest 4 honours that. Vitest 5 gives an inline project the root of the file that declares it, so the package'sinclude: ['src/**/*.spec.ts']resolves from the repo root, and the Angular plugin looks fortsconfig.spec.jsonat the repo root and compiles no templates. Setting a top-levelrootinside the package config does not help; it has to be on the inline entry.Angular 22.1 is not involved. The tests call
vitestdirectly and never go through@angular/build, so its vitest peer range doesn't apply.Changes
chore(frontend): set a root on each vitest projectaddsroot: 'src/frontend/packages/<pkg>'to each of the eight entries. It lands first because it changes nothing under vitest 4, which keeps the next commit a pure dependency change.chore(frontend): move unit tests to vitest 5.0.1bumps the three packages, keeping each one's existing pin style, and adds@oxc-project/runtimeat 0.121.0, the version of the installedoxc-parser.changelog.dfragment.Verification
Full
bun run test, same machine:--project=gitmake check gatepasses on the branch.bun run test:coveragepasses on vitest 5, with the same file and test counts and 63.49% statement coverage.vitest --uistarts, and the page and its assets load.toMatchSnapshotortoMatchInlineSnapshot, so the@analogjs/vitest-angular/setup-snapshotsimport, whose stable 2.7.2 still peers vitest ≤ 4, has nothing to affect.