-
-
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
fix: vm.script code coverage had been tampered (#10645) #10657
Conversation
Hi @jyunhan! Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
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 looks good to me! Could you add a changelog entry as well?
@@ -0,0 +1,15 @@ | |||
function addOne(inputNumber) { |
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.
add some code to this file that's not covered? Just to ensure that works as well
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.
IMHO, this function covered by the tail call from line #14 in the same file.
Do you expect to have a new test case for this function individually?
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
1f8f721
to
6e6a99d
Compare
6e6a99d
to
b3257be
Compare
Not sure if I need help, there are 2 places weird. Why the original test case has different code coverage in the execution environment? |
Hey @jyunhan! Sorry, I completely lost track of this. Can you rebase so we can see what CI says now? |
I merged in |
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
The currently v8-code-coverage would be tampered thru the condition.
To keep all test process works and have new request,
the easiest way to fix it is to remove the one of the culprits at:
https://github.com/facebook/jest/blob/master/packages/jest-runtime/src/index.ts#L830
And do some tricks in currently test.
In the end, the test still goes well and the vm.script() coverage is correct now.
See issue #10645
Test plan
I extend v8Coverage.test and compare if the code coverage report goes 100% in each columns as expection.
A new dependent issue
@SimenB
One of trait of VM.script() is able to assign variable from VM.runInNewContext().
However, there has contradiction between the rule of code-smell and that trait.
Maybe we should have another discussion about how we can process that situation.