-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Closed
Description
Command
test
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
rc.1
Description
When switching from rc.1 to rc.2 I get a lot of these errors when running test with vitest and browser mode:
Cannot configure the test module when the test module has already been instantiated. Make sure you are not using `inject` before `TestBed.configureTestingModule`.
This is using vitest with "@vitest/browser-playwright": "4.0.8", and "options": { "browsers": ["chromium"] } set in the angular.json.
Minimal Reproduction
The errors are flaky, and each run produces a different amount. But I was able to get it to show up relatively reliably in a brand new (ng new) project (on rc.2) by making these changes:
- Install
"@vitest/browser-playwright": "4.0.8", - Add
"options": { "browsers": ["chromium"] }to angular.json test config. - Generate a second component and a service.
- Run
ng test
In that setup, I get the error usually once or twice.
Exception or Error
Your Environment
Angular CLI : 21.0.0-rc.2
Angular : 21.0.0-rc.2
Node.js : 24.11.1
Package Manager : npm 11.6.2
Operating System : darwin arm64
┌───────────────────────────┬───────────────────┬───────────────────┐
│ Package │ Installed Version │ Requested Version │
├───────────────────────────┼───────────────────┼───────────────────┤
│ @angular/build │ 21.0.0-rc.2 │ 21.0.0-rc.2 │
│ @angular/cli │ 21.0.0-rc.2 │ ^21.0.0-rc.2 │
│ @angular/common │ 21.0.0-rc.2 │ ^21.0.0-next.0 │
│ @angular/compiler │ 21.0.0-rc.2 │ ^21.0.0-next.0 │
│ @angular/compiler-cli │ 21.0.0-rc.2 │ ^21.0.0-next.0 │
│ @angular/core │ 21.0.0-rc.2 │ ^21.0.0-next.0 │
│ @angular/forms │ 21.0.0-rc.2 │ ^21.0.0-next.0 │
│ @angular/platform-browser │ 21.0.0-rc.2 │ ^21.0.0-next.0 │
│ @angular/router │ 21.0.0-rc.2 │ ^21.0.0-next.0 │
│ rxjs │ 7.8.2 │ ~7.8.0 │
│ typescript │ 5.9.3 │ ~5.9.2 │
│ vitest │ 4.0.8 │ ^4.0.8 │
└───────────────────────────┴───────────────────┴───────────────────┘
Anything else relevant?
No response
cexbrayat
Metadata
Metadata
Assignees
Labels
No labels