Skip to content

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

Open
@markoblagdan

Description

@markoblagdan

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions