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 hoisting breaks when using @jest/globals #817

Open
Smrtnyk opened this issue Oct 19, 2023 · 0 comments
Open

jest.mock hoisting breaks when using @jest/globals #817

Smrtnyk opened this issue Oct 19, 2023 · 0 comments

Comments

@Smrtnyk
Copy link

Smrtnyk commented Oct 19, 2023

It looks like jest.mock hoisting breaks as soon as jest is imported from @jest/globals
import {jest} from "@jest/globals";
import {foo} from './module1.js';
import {bar} from './module2.js';

jest.mock('./module1.js');

test fails, but if you remove jest import than jest.mock works fine
I assume jest.mock should be hoisted under import of jest/globals or jest/globals should be removed as an import since it should only provide types

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant