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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jest debugging from VScode not working correctly #3310

Closed
TheTFo opened this issue Oct 22, 2017 · 4 comments
Closed

Jest debugging from VScode not working correctly #3310

TheTFo opened this issue Oct 22, 2017 · 4 comments

Comments

@TheTFo
Copy link

TheTFo commented Oct 22, 2017

Is this a bug report?

Yes

Can you also reproduce the problem with npm 4.x?

Not surr

(Write your answer here.)

Which terms did you search for in User Guide?

Jest Debugging

Environment

  1. node -v: 8.5
  2. npm -v: 5.4
  3. yarn --version (if you use Yarn):
  4. npm ls react-scripts (if you haven’t ejected): 1.0.14

Then, specify:

  1. Operating system: windows 8
  2. Browser and version (if relevant):

Steps to Reproduce

Here's repro branch

https://github.com/TheTFo/cria/tree/jest-debug?files=1

Attempt to debug tests from vscode launcher, placing a break point on the line indicated in comment in this file:

https://github.com/TheTFo/cria/blob/jest-debug/src/actions/todoActions.js

Breakpoints don't appear to hit the appropriate lines. Not sure what's causing it. I don't see transpiled code, just wierd breakpoints hits.

Expected Behavior

Breakpoints would hit as expected

Actual Behavior

Breakpoints were all over, not seeing transpiled code though

Reproducible Demo

See branch and file above.

@MFry
Copy link

MFry commented Oct 23, 2017

Node 8 switches to the inspector protocol and some of the older scripts don't work as anticipated, I have had good luck with this launch.json

    {
      "name": "Test with debugger",
      "type": "node",
      "request": "launch",
      "runtimeArgs": ["--nolazy"],
      "program": "${workspaceRoot}/node_modules/jest/bin/jest.js",
      "args": [
        "--runInBand",
        "--transform={\"^.+\\\\.(js|jsx)$\": \"babel-jest\",\"^.+\\\\.css$\": \"jest-css\",\"^(?!.*\\\\.(js|jsx|css|json)$)\": \"jest-file\"}"
      ],
      "stopOnEntry": false,
      "sourceMaps": true,
      "console": "internalConsole",
      "cwd": "${workspaceRoot}"
    }

@gaearon
Copy link
Contributor

gaearon commented Nov 3, 2017

Wanna send a PR to fix it?

@MFry
Copy link

MFry commented Nov 3, 2017

Hello @gaearon !
Absolutely, I will just check a few things to see if anything needs to be polished.

@gaearon
Copy link
Contributor

gaearon commented Jan 8, 2018

This was probably fixed in #3605.

@gaearon gaearon closed this as completed Jan 8, 2018
@lock lock bot locked and limited conversation to collaborators Jan 20, 2019
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