-
-
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-reporters): move helpers from utils.ts
into separate files
#12782
Conversation
@@ -33,11 +33,13 @@ | |||
"jest-worker": "^28.0.2", | |||
"slash": "^3.0.0", | |||
"string-length": "^4.0.1", | |||
"strip-ansi": "^6.0.0", |
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.
Noticed that GitHubActionsReporter
needs it:
Yeah, I prefer this 👍 I do think it's a bug in the bundler, tho. Or is it tsc that emits the deep imports? |
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.
nice 👍
(changelog?)
|
By the way, I was also checking if other |
Awesome! Could we maybe add a check that there is no |
Sure. I look a look at validation logic. Might be better to run it after bundling, or? Perhaps I will open a separate PR and we can figure out there? |
Yep and yep 👍 |
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. |
Fixes #12772
Closes #12773
Summary
Several
@jest-reporters
helper utils currently live in separate files (likegetResultHeader
orgetSnapshotStatus
), some are exported fromutils.ts
. That’s all fine, onlytsc
gets somewhat confused and emitsindex.d.ts
like this:Note the difference between
getResultHeader
(lives in separate file) andformatTestPath
(imported fromutils.ts
). Reaching intobuild
is one of the reasons causing the issue reported in #12772 and possibly could break something else in the future.I found two possible solutions:
utils.ts
and use a star import inindex.ts
(POC in chore: do not bundle@jest/types
#12773);utils.ts
into separate files (this PR).The latter one seemed somewhat nicer. If it doesn’t create too many files?
Test plan
Type tests for utils are added. Some of the tests are failing on
main
, but are passing on this branch.