-
-
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
Produce source maps when instrumenting code #9460
Conversation
Codecov Report
@@ Coverage Diff @@
## master #9460 +/- ##
==========================================
+ Coverage 64.96% 64.99% +0.03%
==========================================
Files 283 283
Lines 12104 12108 +4
Branches 2990 2992 +2
==========================================
+ Hits 7863 7870 +7
+ Misses 3604 3603 -1
+ Partials 637 635 -2
Continue to review full report at Codecov.
|
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 great, thank you! I left a couple of nits but overall this LGTM 👍
packages/jest-transform/src/__tests__/script_transformer.test.js
Outdated
Show resolved
Hide resolved
packages/jest-transform/src/__tests__/script_transformer.test.js
Outdated
Show resolved
Hide resolved
Thanks for the approval, expect to be able to work through the feedback over the next few days. |
Pushed a cleanup commit addressing review feedback. |
Thank you! A long-standing issue, great that it's finally fixed 👍 |
return code; | ||
} | ||
if (result && result.code) { | ||
return result as TransformResult; |
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 could create a type guard function and avoid the cast, but it's not any more type safe. so meh
This reverts commit 03a7877.
This reverts commit 03a7877.
This reverts commit 03a7877.
This reverts commit 03a7877.
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
This change generates inline and separate file source maps for the instrumented code produced when Jest runs with
--coverage
in the case that the code has been transformed.While coverage reporting appears to function correctly in this case prior to this PR, debugging code under test did not work as expected, nor did stack traces emitted by errors in code under test.
Fixes #5739
Test plan
I primarily tested this by running Jest against a small test project (https://github.com/mbpreble/jest-test)
Running my local Jest branch against the project produces the expected coverage output and stack trace for the thrown error in the test code. I am also able to debug Jest using the Node debugger and hit break points in my test code:
Unit tests have been added/modified to reflect the new source map behavior.