Skip to content
This repository has been 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

Open
lionskape opened this issue Apr 14, 2024 · 0 comments
Open

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

lionskape opened this issue Apr 14, 2024 · 0 comments

Comments

@lionskape
Copy link

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)

@lionskape lionskape changed the title jest.mock is not working if globals does not injected jest.mock is not working if import something from "@jest/globals" Apr 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant