Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling code coverage breaks source maps #8684

Closed
WhitWaldo opened this issue Jul 13, 2019 · 3 comments
Closed

Enabling code coverage breaks source maps #8684

WhitWaldo opened this issue Jul 13, 2019 · 3 comments

Comments

@WhitWaldo
Copy link

馃悰 Bug Report

While debugging in VS Code per the instructions here, I quickly noticed that when stepping through logic, the indicated active line would keep showing as the last one in any given file, which was incorrect. After stepping through it in the browser, I found that all the names were jumbled because of all the Cobertura markup in the source map.

Once I disabled code coverage in the build, debugging worked like a charm again.

To Reproduce

Steps to reproduce the behavior:
Add "'collectCoverage': true," to the jest configuration along with the "html" and "cobertura" reporters and start debugging. Look at the source map (either in VS Code or in your browser) and observe all the markup.

Stepping through the logic in VS Code will jump your view to the last line of the active document after the entry debugging line/breakpoint.

Expected behavior

Ideally, while code coverage requires all this markup in the source maps, the source maps would be generated anew after the code coverage has completed so as to enable a smooth debugging experience.

Link to repl or repo (highly encouraged)

Will follow-up with a repo for this in the next few days.

Run npx envinfo --preset jest

Paste the results here:

npx: installed 1 in 2.074s

  System:
    OS: Windows 10
    CPU: (32) x64 AMD Ryzen Threadripper 1950X 16-Core Processor
  Binaries:
    Node: 10.13.0 - M:\Program Files\nodejs\node.EXE
    Yarn: 1.15.2 - L:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.4.0 - M:\Program Files\nodejs\npm.CMD
@SimenB
Copy link
Member

SimenB commented Jul 15, 2019

Does any of the tips in facebook/create-react-app#5319 help? In particular the flag discussed in facebook/create-react-app#5319 (comment) (I don't think it's the current name).

Jest does generate separate source maps when using coverage as it works by injecting code to count coverage (until #8596 is merged). However, we've seen issues where vs code is too eager. I don't use vs code myself though, so I'm not much help unfortunately

@thymikee
Copy link
Collaborator

Closing due to lack of activity from the OP

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants