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
Flaky test failure in vitest browser mode when passing strings to render #569
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.0
vitest4.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.
Thanks for creating the issue, I wonder if this could be resolved in #570 🤔.
If not, then this could be tricky - dropping support for templates could be an option...
Thanks for creating the issue, I wonder if this could be resolved in #570 🤔. If not, then this could be tricky - dropping support for templates could be an option...
It indeed seems to be resolved in @testing-library/angular/zoneless. I switched the code base that was previously exhibiting this issue to the zoneless render function and converted the problematic test cases back to templates without encountering this issue.
Activity
timdeschryver commentedon Mar 8, 2026
Thanks for creating the issue, I wonder if this could be resolved in #570 🤔.
If not, then this could be tricky - dropping support for templates could be an option...
ThiloAschebrock commentedon Mar 18, 2026
It indeed seems to be resolved in
@testing-library/angular/zoneless. I switched the code base that was previously exhibiting this issue to the zoneless render function and converted the problematic test cases back to templates without encountering this issue.