-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
fix (jest-runtime): correct wrapperLength value for ESM modules
#11893
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
SimenB
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.
this looks pretty good! I'd like to keep the existent test as is, but beyond that this LGTM 🙂
|
@SimenB All (should be) fixed as suggested. Thanks for the review. |
wrapperLength to fileTransforms for ESM moduleswrapperLength value for ESM modules
Codecov Report
@@ Coverage Diff @@
## main #11893 +/- ##
==========================================
- Coverage 68.87% 68.73% -0.14%
==========================================
Files 312 322 +10
Lines 16432 16580 +148
Branches 4768 4784 +16
==========================================
+ Hits 11318 11397 +79
- Misses 5087 5150 +63
- Partials 27 33 +6
Continue to review full report at Codecov.
|
SimenB
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.
thanks!
|
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
Resolves #11891.
v8 coverage reports were incorrect in ESM mode. Seems like
wrapperLengthvalue was the problem. If I got it right,transformFileAsyncis called only in ESM mode. And if I get it right, the wrapper is CJS module wrapper. ESM is not using it, so perhaps the best solution is to keep the value ofwrapperLengthundefined. Simply: the wrapper does not exist.Test plan
I started form failing tests. The failing ones were:
esm-native-without-sourcemapandesm-with-custom-transformer.It seemed useful to rename the v8 test directory by prefixing it with
coverage-(coverage-provider-v8instead ofv8-coverage). This way all coverage related tests live next to each other. Easier to find them.I created tests for both native
cjsand nativeems. ThewrapperLengthvalue is the imporntant difference, which has to be covered by tests. The wrapper is only important for v8 coverage.cjs-nativeandesm-nativetests are also proving that coverage report looks good if source map is not included. Here the source code is not transformed at all, hence we do not have source map.These two tests are fully replacing currentno-sourcemaptest, which I removed as unnecessary.