Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant