-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Run code transforms over global{Setup,Teardown}
#7562
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
| import type {Test} from 'types/TestRunner'; | ||
|
|
||
| import {extname, resolve} from 'path'; | ||
| import pEachSeries from 'p-each-series'; |
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.
using p-each-series allows us to make sure one require hook does not interfere with another
|
|
||
| import {extname, resolve} from 'path'; | ||
| import pEachSeries from 'p-each-series'; | ||
| import {addHook} from 'pirates'; |
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.
pirates is what babel-register uses
65a50f8 to
53e8f54
Compare
Codecov Report
@@ Coverage Diff @@
## master #7562 +/- ##
==========================================
- Coverage 68.28% 67.93% -0.36%
==========================================
Files 250 248 -2
Lines 9627 9503 -124
Branches 5 5
==========================================
- Hits 6574 6456 -118
+ Misses 3051 3045 -6
Partials 2 2
Continue to review full report at Codecov.
|
da9c958 to
655d16e
Compare
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.
☠️ pirates!
655d16e to
8b3b505
Compare
8b3b505 to
650a23e
Compare
rickhanlonii
left a comment
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.
Legit
|
This doesn't work with "testEnvironment" |
|
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
Fixes #5164. A caveat is that this can not transpile stuff in
node_modules. This is because in order to transpile using e.g.babel-jest, we would need to loadbabel-jest, which means we cannot transpile it.We could try to do static analysis on the transformer modules defined in the config and create a dependency tree of the only files we won't transform, but I'm not sure if it's worth it (or possible). Stuff in
node_modulesshould be runnable in node either way.EDIT: If people want, we can disable
node-modulesignoring, and try to catch errors during transform. By default, Jest hastransformIgnorePatternonnode_modules, so shouldn't make a huge differenceTest plan
I added a flow annotation to an existing test to show the transform happens.