-
Notifications
You must be signed in to change notification settings - Fork 90
Open
Description
Summary
Test files pass in isolation but fail in full-suite runs with:
Error: Cannot configure the test module when the test module has already been instantiated. Make sure you are not using inject before TestBed.configureTestingModule.
This error always appears together with:
TypeError: Cannot redefine property: ɵcmp
Environment
- Angular
21.2.1 @testing-library/angular19.1.0vitest4.0.18@vitest/browser-playwright4.0.18- Chromium browser mode via Angular unit-test builder or AnalogJS
Pattern that triggers the issue
- Use
render(...)from@testing-library/angular - Use template-string rendering (not component class rendering)
- Run many tests/files in browser mode in the same run
Expected
Full-suite and isolated runs should behave consistently without TestBed/component metadata lifecycle errors.
Actual
In the larger suite, full runs intermittently fail with both errors (Cannot configure the test module... and Cannot redefine property: ɵcmp).
However, finding a minimal example to reproduce the issue consistently is challenging.
Workaround
Switching away from template-string wrapper patterns to explicit host components makes the failures disappear. I could, further, only see these failures in browser mode. Running a similar set of tests with JSDOM, did not cause these failures.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels