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

Latest upgrade to Version 1.19.1 (1.19.1) breaks Jest Test Debugging Capabilities #40896

Closed
Dimomir opened this issue Dec 28, 2017 · 4 comments
Closed
Assignees
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues *duplicate Issue identified as a duplicate of another issue(s)

Comments

@Dimomir
Copy link

Dimomir commented Dec 28, 2017

  • VSCode Version: Version 1.19.1 (1.19.1)
  • OS Version: OS X El Capitan 10.11.6 (15G1421)

Hi there, I suspect the newest update might be breaking the Jest debugging. Here's my config taken straight from Jest's website: .

Note: I'm using the CRA setup

{
      "name": "Debug CRA Tests",
      "type": "node",
      "request": "launch",
      "runtimeExecutable": "${workspaceRoot}/client/node_modules/.bin/react-scripts",
      "runtimeArgs": ["--inspect-brk", "test"],
      "args": ["--runInBand", "--no-cache", "--env=jsdom"],
      "cwd": "${workspaceRoot}/client",
      "protocol": "inspector",
      "console": "integratedTerminal",
      "internalConsoleOptions": "neverOpen"
}

Steps to Reproduce:

When I try to start debugging (which I can confirm was working with previous versions) I now get the error:
Error: Cannot connect to runtime process, timeout after 10000 ms - (reason: Cannot connect to the target: connect ECONNREFUSED 127.0.0.1:3269).

Could you please point me to what I'm missing?
💭
🤔

@vscodebot vscodebot bot added the debug Debug viewlet, configurations, breakpoints, adapter issues label Dec 28, 2017
@Dimomir Dimomir closed this as completed Dec 28, 2017
@Dimomir Dimomir reopened this Dec 28, 2017
@Dimomir Dimomir changed the title Cannot connect to runtime process, timeout after 10000 ms - (reason: Cannot connect to the target: connect ECONNREFUSED 127.0.0.1:3269). Latest upgrade to Version 1.19.1 (1.19.1) breaks Jest Test Debugging Capabilities Dec 28, 2017
@isidorn isidorn assigned weinand and unassigned isidorn Dec 28, 2017
@weinand
Copy link
Contributor

weinand commented Dec 28, 2017

duplicate of #40254.

The launch config from Jest's website is wrong.
Use this launch config:

{
      "name": "Debug CRA Tests",
      "type": "node",
      "request": "launch",
      "runtimeExecutable": "${workspaceRoot}/client/node_modules/.bin/react-scripts",
      "args": [ "test", "--runInBand", "--no-cache", "--env=jsdom" ],
      "cwd": "${workspaceRoot}/client",
      "protocol": "inspector",
      "console": "integratedTerminal",
      "internalConsoleOptions": "neverOpen"
}

@weinand weinand closed this as completed Dec 28, 2017
@weinand weinand added the *duplicate Issue identified as a duplicate of another issue(s) label Dec 28, 2017
@Dimomir
Copy link
Author

Dimomir commented Dec 28, 2017

I can confirm the above solution works 👌

Thank you kindly for your time @weinand

@Phlow2001
Copy link

Phlow2001 commented Feb 9, 2018

For those that ended up here because VSCode debugging for jest on windows STILL doesn't work, try the following:

        {
          "name": "Debug Jest Tests",
          "type": "node",
          "request": "launch",
          "runtimeArgs": [
              "--inspect-brk=5555",
              "${workspaceRoot}/node_modules/jest/bin/jest.js"
          ],
          "args": [
              "--runInBand",
          ],
          "port": 5555,
          "protocol": "inspector",
          "console": "integratedTerminal",
          "internalConsoleOptions": "neverOpen"
        }

@weinand
Copy link
Contributor

weinand commented Feb 9, 2018

@Phlow2001 this (simpler) launch config should be equivalent for VS Code > 1.19:

        {
          "name": "Debug Jest Tests",
          "type": "node",
          "request": "launch",
          "program": "${workspaceFolder}/node_modules/jest/bin/jest.js",
          "args": [
              "--runInBand",
          ],
          "protocol": "inspector",
          "console": "integratedTerminal",
          "internalConsoleOptions": "neverOpen"
        }

And you only need the "protocol" attribute if you are using node.js < 8.0

@vscodebot vscodebot bot locked and limited conversation to collaborators Feb 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues *duplicate Issue identified as a duplicate of another issue(s)
Projects
None yet
Development

No branches or pull requests

4 participants