-
Notifications
You must be signed in to change notification settings - Fork 455
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
Support hoisting when import from @jest/globals #1593
Labels
Comments
do you mind picking this up @G-Rath ? |
ahnpnl
changed the title
Support hoisting when import from
Support hoisting when import from @jest/global
May 4, 2020
@jest/global
ahnpnl
changed the title
Support hoisting when import from @jest/global
Support hoisting when import from @jest/globals
May 4, 2020
Hello !! I have have an issue which seems related. I'm trying to mock a module :
But then I have this error message :
Do you think guys it can be related ? :) Many thx !! |
if you import anything from @Xb0X Your issue is reported here jestjs/jest#10218, it's related to |
This was referenced Sep 9, 2020
ahnpnl
added a commit
that referenced
this issue
Sep 10, 2020
Support hoisting when using `@jest/globals`, applying to: - named import, e.g. `import { jest } from '@jest/globals'` - aliased named import, e.g. `import {jest as aliasedJest} from '@jest/globals'` - namespace import, e.g `import * as JestGlobals from '@jest/globals'` Closes #1593
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
🚀 Feature Proposal
Jest has a new package
@jest/globals
in v25.5.0 which Jest's globals can be explicitly imported.The introduction of this new package also led to the change of hoisting in
babel-jest
plugin. We also need to do the similar thing, referencing Jest PR jestjs/jest#9806Motivation
To make hoisting behavior not different between
babel-jest
andts-jest
so users won't encounter any issues.Example
See example in jestjs/jest#9806
The text was updated successfully, but these errors were encountered: