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

chore: use @jest/globals instead of @types/jest #74

Merged
merged 3 commits into from
Sep 25, 2024

Conversation

mrazauskas
Copy link

Pull Request

Problem

The @types/jest is redundant, because Jest ships typings via @jest/globals package. (By the way, Jest repo has type tests with more than 1000 assertions.)

Main difference: testing APIs must be explicitly imported from @jest/globals, instead of being globally available. This means that in a way @types/jest is polluting the global namespace. For instance, currently it is possible to use Jest's test() helper in type tests. That does not sound right, or?

Solution

Replaced @types/jest with imports from @jest/globals.

ChangeLog

N/A

package.json Show resolved Hide resolved
@shadowspawn shadowspawn changed the base branch from main to develop September 5, 2024 23:24
jest.config.js Outdated Show resolved Hide resolved
Copy link
Contributor

@shadowspawn shadowspawn left a comment

Choose a reason for hiding this comment

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

Looks good apart from setting for injectGlobals.

Copy link
Contributor

@shadowspawn shadowspawn left a comment

Choose a reason for hiding this comment

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

LGTM, thanks

@shadowspawn shadowspawn added the pending release On a branch for eventual release, but not yet merged to main. label Sep 25, 2024
@shadowspawn shadowspawn merged commit c15aa04 into commander-js:develop Sep 25, 2024
9 checks passed
@mrazauskas mrazauskas deleted the use-@jest/globals branch September 25, 2024 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending release On a branch for eventual release, but not yet merged to main.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants