-
Notifications
You must be signed in to change notification settings - Fork 128
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
Rewire messes up line number reporting in Jest #165
Comments
lorenzos
changed the title
Rewire screws line reporting in Jest, I think
Rewire mess up line number reporting in Jest, I think
May 17, 2019
lorenzos
changed the title
Rewire mess up line number reporting in Jest, I think
Rewire messes up line number reporting in Jest, I think
May 17, 2019
lorenzos
changed the title
Rewire messes up line number reporting in Jest, I think
Rewire messes up line number reporting in Jest
May 17, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When I use
rewire()
in my Jest test files, JEST CLI starts reporting wrong lines when highlighting errors and failed test. I don't know if it's a Rewire or Jest issue, however everything works correctly when not callingrewire()
and using normalrequire()
instead.Here's all you need to reproduce:
Now, if you run
npm test
, the test correctly runs and fails on the firstexpect()
, but the third one is highlighted. Here's the output of Jest, note how expected and received values are correct, but highlighted is wrong:Funnilly enough, if you don't use Rewire's
__get__
to get the test function, but simply usemain.sum
instead, Jest highlights a different wrong line, the secondexpect()
:Lastly, if you don't use Rewire altogether, including the main module with
require('./main.js')
and commenting outrequire('rewire')
, everything is correct:Thanks.
The text was updated successfully, but these errors were encountered: