+
Skip to content

Can't test with it/describe.each and fakeAsync #1115

Closed
@jahusa02

Description

@jahusa02

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载