Skip to content
This repository has been archived by the owner on Jan 26, 2019. It is now read-only.

VS Code - debugging tests - cannot connect to runtime process, timeout after 10000 ms #209

Closed
MatejBransky opened this issue Dec 15, 2017 · 2 comments

Comments

@MatejBransky
Copy link

MatejBransky commented Dec 15, 2017

Is this a bug report?

Yes

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

Yes

Which terms did you search for in User Guide?

react-scripts-ts vs code debug
react-scripts-ts vs code debug tests
typescript jest vs code Cannot connect to runtime process, timeout after 10000 ms
vs code Cannot connect to runtime process, timeout after 10000 ms
...

Environment

  1. node -v: 8.9.1
  2. npm -v: 5.5.1
  3. yarn --version (if you use Yarn):
  4. npm ls react-scripts-ts (if you haven’t ejected): 2.8.0

Then, specify:

  1. Operating system: Windows 10
  2. Browser and version (if relevant): -

Steps to Reproduce

  1. create project with create-react-app --scripts-version=react-scripts-ts
  2. set debugging tests
{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Debug CRA Tests",
      "type": "node",
      "request": "launch",
      "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/react-scripts-ts",
      "runtimeArgs": [
        "--inspect-brk",
        "test"
      ],
      "args": [
        "--runInBand",
        "--no-cache"
      ],
      "cwd": "${workspaceRoot}",
      "protocol": "inspector",
      "console": "integratedTerminal",
      "internalConsoleOptions": "neverOpen"
    }
  ]
}
  1. run debugging test in VS Code

Expected Behavior

It should start the debugging of tests.

Actual Behavior

Until a few seconds it shows error message:
image

@DorianGrey
Copy link
Collaborator

The configuration you mentioned does no longer work in VS Code 1.19 and above, and regarding the issues listed in the VS Code repo, it only worked before due to a bug. See the comment from @weinand:
microsoft/vscode#40293 (comment)

The updated config should look like this (adopted):

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

A quick check with VS Code 1.19 on Win 10 with a freshly generated app confirmed that this works fine.

References:

@Guria
Copy link

Guria commented Dec 16, 2017

When I last tried debugging in vs code + chrome it catched breakpoints only after page refresh. The same was about original CRA as well.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants