Skip to content
This repository was archived by the owner on Jan 16, 2025. It is now read-only.
This repository was archived by the owner on Jan 16, 2025. It is now read-only.

jest.mock is not working if import something from "@jest/globals" #172

@lionskape

Description

@lionskape

Hi.

Note: I have read that article: swc-project/swc#7435

I faced with some issues here:

  1. I disabled globals injection in Jest (in favor of explicit import from "@jest/globals" to avoid types collision. I also have e2e testing framework which uses global types for it/describe and it is different). https://jestjs.io/docs/cli#--injectglobals
  2. I tried to use jest.mock function to create an automatic mock for module (automatically wrap exports with jest.fn())
  3. Found that jest.mock is not working properly

Looks like similar issue was described here: #120
So, reproducing case is the same (https://github.com/Smrtnyk/swc-jest-globals-repro)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions