-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Description
Which @angular/* package(s) are the source of the bug?
Don't known / other
Is this a regression?
No
Description
When providing a custom vite config for testing with vitest, not all properties are respected.
Please provide a link to a minimal reproduction of the bug
https://github.com/dnd-mapp/dma-resources-client
Please provide the exception or error you saw
I've configured vitest with the following settings:
- browser based testing with playwright.
- enabled code coverage reporting.
- overwritten the output directory of the vitest reports and coverage reports.
- enabled UI when the
CIenvironment variable is not set.
I need to install jsdom or happy-dom in order to be able to run tests, while I don't use any of these environments. I get the following error if I don't have any of these dependencies installed:
> ng test -c dev
The following packages are required but were not found:
- A DOM environment is required for non-browser tests. Please install either "jsdom" or "happy-dom".
Please install the missing packages and rerun the test command.
After that it seems like the that even though I've overwritten the output directory of the reporters and the code coverage reporters, somehow reports and code coverage reports are also outputted at coverage/<project-name> and coverage/<project-name>/coverage, but the coverage reports are missing where I actually want them (reports/coverage).
In dev mode, the ui setting seems to be ignored entirely.
Furthermore, the code coverage calculation seems to be totally wrong since it's reporting 0% coverage while there practically no lines, branches, functions, or statements, but the only component that is currently present in the linked repository is tested to verify that it can render.
I'd expect that I shouldn't need to have jsdom or happy-dom installed as dependency if I have not configured either of these environments to be used for vitest.
I'd also expect my reports and coverage reports to be outputted where I have configured them to be outputted and that the UI is enabled when I want it to.
Please provide the environment you discovered this bug in (run ng version)
Angular CLI : 21.0.1
Angular : 21.0.1
Node.js : 24.11.1
Package Manager : pnpm 10.23.0
Operating System : win32 x64
| Package | Installed Version | Requested Version |
|---|---|---|
| @angular/build | 21.0.1 | ~21.0.0 |
| @angular/cdk | 21.0.1 | ~21.0.0 |
| @angular/cli | 21.0.1 | ~21.0.0 |
| @angular/common | 21.0.1 | ~21.0.0 |
| @angular/compiler | 21.0.1 | ~21.0.0 |
| @angular/compiler-cli | 21.0.1 | ~21.0.0 |
| @angular/core | 21.0.1 | ~21.0.0 |
| @angular/forms | 21.0.1 | ~21.0.0 |
| @angular/platform-browser | 21.0.1 | ~21.0.0 |
| @angular/router | 21.0.1 | ~21.0.0 |
| rxjs | 7.8.2 | ~7.8.0 |
| typescript | 5.9.3 | ~5.9.0 |
| vitest | 4.0.14 | ~4.0.0 |
Anything else?
No response