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

feat: prefer importing jest globals for specific types #1568

Merged
merged 2 commits into from
Apr 27, 2024

Conversation

tomquist
Copy link
Contributor

Accessing the jest global in ESM must be done either through import.meta.jest or by importing it from @jest/globals. The latter is useful while migrating to ESM because the former is not accessible in non-ESM.

This adds an option to specify the types of globals for which we want to enforce the import.

@tomquist tomquist force-pushed the add-jest-global-types branch 2 times, most recently from 5b7aa20 to 38eb74a Compare April 26, 2024 13:32
Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea 👍

@SimenB SimenB requested a review from G-Rath April 26, 2024 13:38
Copy link
Collaborator

@G-Rath G-Rath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool, but I think let's drop the tuple utils stuff - I'm pretty confident we'll not be adding any new types anytime soon, so we should be safe to just directly write out the tuple

Accessing the `jest` global in ESM must be done either through
`import.meta.jest` or by importing it from `@jest/globals`. The latter
is useful while migrating to ESM because the former is not accessible
in non-ESM.

This adds an option to specify the types of globals for which we want
to enforce the import.
@tomquist
Copy link
Contributor Author

Thanks for the quick review!

@G-Rath G-Rath merged commit c464ae3 into jest-community:main Apr 27, 2024
36 checks passed
github-actions bot pushed a commit that referenced this pull request Apr 27, 2024
# [28.3.0](v28.2.0...v28.3.0) (2024-04-27)

### Features

* prefer importing jest globals for specific types ([#1568](#1568)) ([c464ae3](c464ae3))
Copy link

🎉 This PR is included in version 28.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

3 participants