Cannot hit breakpoint inside a test with VS Code IDE
See original GitHub issueEnvironment
-
node -v
: [v10.12.0] -
npm -v
: [6.4.1] -
npm ls jest
ornpm ls react-scripts
(if you haven’t ejected): [jest@23.6.0] -
your vscode-jest settings if customized:
- jest.pathToJest? [not set]
- jest.pathToConfig? [not set]
- anything else that you think might be relevant? []
-
Operating system: [Ubuntu 18.04]
Prerequisite
- are you able to run jest test from command line? [yes]
- how do yo run your tests from command line? (for example:
npm run test
ornode_modules/.bin/jest
) [npm run test]
Steps to Reproduce
Here is a really simple repository that show it is not possible to hit breakpoint into the file user.repository.spec.ts on line 12 const users = await userRepository.getAll(); https://github.com/stherrienaspnet/vscode-jest-debug.git
Relevant Debug Info
[Did not found any resolution yet]
Expected Behavior
[Should break on line 12 when there is a breakpoint and press play vscode-jest-test in launch menu ]
Actual Behavior
[Break on line 12 is not hit]
Thanks you very much!
The fastest (and the most fun) way to resolve the issue is to submit a pull-request yourself. If you are interested, feel free to check out the contribution guide, we look forward to seeing your PR…
Issue Analytics
- State:
- Created 5 years ago
- Reactions:8
- Comments:8
Top GitHub Comments
Possible solution: For me, the reason why I couldn’t hit the correct line was due to sourcemaps being incorrect/absent due to an issue with
ts-jest
when Jest’scollectCoverage
option was set to true. https://github.com/kulshekhar/ts-jest/issues/917Setting that to false allowed the green CodeLens [debug] button to properly hit my code at the desired lines.
When launching jest as a debug task, adding the option
disableOptimisticBPs
fix this issueFull context at https://github.com/Microsoft/vscode/issues/60187
Not sure if or how this can be used to fix this issue
Below is a config that works