Is this a regression?
The previous version in which this bug was not present was
v20.2.2
Description
Hello, I updated my project where I use material from angular version 20.2.2 to version 21.0.5. After updating Angular I configured it to work with Vitest when i run ng test. It all works fine except when I do the following line const loader = TestbedHarnessEnvironment.loader(fixture); in my tests.
When that line is in my spec file and I run ng test I get the error Error: Expected to be running in 'ProxyZone', but it was not found..
How can I solve this so my tests that use TestbedHarnessEnvironment.loader will run again?
Reproduction
I tried to make a stackblitz, but wasn't able to get ng serve with vitest to work.
StackBlitz link: https://stackblitz.com/edit/stackblitz-starters-peyuzeyh?file=src%2Fapp%2Fapp.component.spec.ts
Steps to reproduce:
- Install angular 21
- Install Material
npm i -D vitest jsdom
- configure test in angular.json
- Add mat-form-field to html of component
- Add spec file to component that uses TestbedHarnessEnvironment.loader
- Run ng test
Expected Behavior
Test should work, not throw error and pass
Actual Behavior
ng test throws error: Error: Expected to be running in 'ProxyZone', but it was not found.
Environment
- Angular: 21.0.5
- CDK/Material: 21.0.3
- Browser(s): Chrome
- Operating System: Windows