-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
fix(@jest/test-utils): use build-in Jest types instead of @types/jest
#13283
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
Conversation
| /* eslint-disable jest/no-focused-tests */ | ||
|
|
||
| import semver = require('semver'); | ||
| import type {Global} from '@jest/types'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a reminder. It is not possible to import from @jest/globals, because @jest/globals depend on expect which depends on @jest/test-utils. That’s circular. In contrary @jest/types currently depends only on @jest/schemas.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should fix the cycle - lerna warns every time I publish. Would be nice if yarn did the same on install
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does Lerna find a cycle?
In this comment I try to say that here importing from @jest/types does not create a cycle, but importing from @jest/globals would. In earlier PR it was your suggestion to import from @jest/globals. I tried that and hit the circular dips error. This is simply an explanation why I went for importing from @jest/types (;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pretty-format has a dev dep on expect
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. I recall that. It was added in #12626
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup
| * LICENSE file in the root directory of this source tree. | ||
| */ | ||
|
|
||
| /* eslint-disable jest/no-focused-tests */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is weird. But I think it'd work if imported from @jest/globals, so probably fine 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. Just check, it works if imported from @jest/globals.
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
As it was noticed in #12856,
test-utilscould use build-in Jest types instead of@types/jest. Bumped into this again while working on another idea. Perhaps it makes sense to land this separately?Test plan
Should build without type errors.