Skip to content

Jest debugging from VScode not working correctly #3310

Closed

Description

@TheTFo

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.

Activity

  1. MFry commented on Oct 23, 2017

    @MFry

    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}"
        }
    
  2. gaearon commented on Nov 3, 2017

    @gaearon
    Contributor

    Wanna send a PR to fix it?

  3. MFry commented on Nov 3, 2017

    @MFry

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

  4. gaearon commented on Jan 8, 2018

    @gaearon
    Contributor

    This was probably fixed in #3605.

  5. locked and limited conversation to collaborators on Jan 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions