Do not import @jest/globals
outside of the Jest test environment
#290
Unanswered
biglebronski
asked this question in
Q&A
Replies: 2 comments
-
I have not seen that error before. I don't think it is relate to test utils (not clear what you mean by mocks in the global scope messing up things). You will need to post a full reproduction if you want help, there is no way to reproduce the error with just your jest.config. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Most likely you have installed two jest versions because of version conflict. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I see in the docs that mocks are implemented in the global scope during
mount()
. I have some tests that are testing against Typescript classes and modules, not Vue components, and I'm trying to usejest.mock()
there and getting this error.Test suite failed to run
Do not import '@jest/globals' outside of the Jest test environment
This error seems to have started with
babel-jest@^25
, and can be resolved by rolling back that package tov21.2
. However, there are multiple potential issues with doing that, as I don't want to use different versions of babel/babel-jest/ts-jest and alsovue-test-utils-next
wantsbabel-jest@^25.2.3
.Has anyone here seen this before and possibly know a better way to resolve it?
Here is my jest config if that helps.
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions