jest-preset-angular icon indicating copy to clipboard operation
jest-preset-angular copied to clipboard

[Bug]: ProxyZone not found when using jest functions imported from @jest/globals

Open markoblagdan opened this issue 2 years ago • 1 comments

Version

13.1.4

Steps to reproduce

  1. In a unit test file, import jest functions from @jest/globals package (example: import { describe, beforeEach, it } from '@jest/globals'; )
  2. Create a jest unit test and wrap an it or beforeEach callback with waitForAsync .
  3. Run unit test

Minimal repro available at https://stackblitz.com/edit/angular-16-jest-preset-cvsyqh?file=src%2Fapp%2Fapp.component.spec.ts

Expected behavior

Unit tests wrapped in waitForAsync (and fakeAsync? but haven't tested) should be able to run in ProxyZone.

Actual behavior

Wrapped unit test fails with message:

Expected to be running in 'ProxyZone', but it was not found.

Additional context

No response

Environment

System:
    OS: Linux 5.0 undefined (also occurs on Windows 10)
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
  Binaries:
    Node: 18.18.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.4.2 - /usr/local/bin/npm
    pnpm: 8.10.5 - /usr/local/bin/pnpm
  npmPackages:
    jest: ^29.7.0 => 29.7.0 

Additional: Angular packages are versioned ^16.0.4

markoblagdan avatar Nov 28 '23 15:11 markoblagdan

I believe this is an issue in upstream Zone.js, hence I created https://github.com/angular/angular/issues/47603

dhardtke avatar Dec 11 '23 01:12 dhardtke