analog
analog copied to clipboard
Can't test with `it/describe.each` and `fakeAsync`
Please provide the environment you discovered this bug in.
https://stackblitz.com/~/github.com/jahusa02/analog-vitest
Which area/package is the issue in?
vitest-angular
Description
When a testfile contains it/describe.each
and fakeAsync
the tests errors out.
I described the error in this Issue https://github.com/analogjs/analog/issues/841#issuecomment-2110296265|
When I use the patched function (e.g. not importing it via import { it } from 'vitest'
), the it.each
tests will fail.
TypeError: Cannot read properties of undefined (reading 'withContext')
❯ ../../../packages/vite-plugin-angular/setup-vitest.ts:247:31
❯ src/lib/+state/effects/add-pending-contract/add-pending-contract.effects.spec.ts:98:6
96| { formStateValid: false, contractId: 'foo', satznummer: null },
97| { formStateValid: false, contractId: null, satznummer: 'bar' },
98| ])(
| ^
99| 'should not post form values if ContractIds are %j',
100| ({ formStateValid, contractId, satznummer }) => {
❯ _ZoneDelegate.invoke ../../../node_modules/zone.js/fesm2015/zone.js:365:28
❯ ZoneImpl.run ../../../node_modules/zone.js/fesm2015/zone.js:111:43
❯ ../../../packages/vite-plugin-angular/setup-vitest.ts:41:21
When I importing it
, the fakeAsync
tests will fail with the mentioned Error: Expected to be running in 'ProxyZone', but it was not found.
, but the it.each
will pass.
Please provide the exception or error you saw
Either
TypeError: Cannot read properties of undefined (reading 'withContext')
or
Error: Expected to be running in 'ProxyZone', but it was not found.
Other information
No response
I would be willing to submit a PR to fix this issue
- [ ] Yes
- [ ] No