-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
refactor(jest-runtime): do not import from @jest/globals
#12411
Conversation
A type test ensuring the types match would be nice, so we're sure they don't drift. import type * as JestGlobalsPkg from '@jest/globals';
import type {JestGlobals} from 'jest-runtime';
expectAssignable<JestGlobalsPkg>({} as JestGlobals);
expectAssignable<JestGlobals>({} as JestGlobalsPkg);
Not sure how that would shake out for I still want |
Hm.. Another related idea is to move That’s why it seemed reasonable also to think about moving Might be I am thinking about something very complicated, but the solution could be much more simple. |
Or |
And that is how it all work here. Got it (; |
I'm very interested in having An alternative is a That way we wouldn't need (as I typed out this alternative I got quite excited again, I think that can work out great long term (albeit some churn for people using |
Not sure I understood all details, but this might be brilliant. Breaking, but not too bad. I think, making it all work without |
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
Currently
jest-runtime
is importing types from@jest/globals
, seems like there is no need for that. All necessary types can be imported directly.The only change –
@jest/globals
is removed fromjest-runtime
dependency graph.Semi-related idea. If this change is accepted, none of the packages in the repo will depend on
@jest/globals
. What if the code of@jest/globals
would be moved intojest
? Just wondering, if the guide for typed testing could look like this:yarn add -D jest
import {expect, jest, test} from 'jest';
Test plan
Green CI