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

Debug CRA Tests stopped working on v1.19 #40293

Closed
amadeogallardo opened this issue Dec 15, 2017 · 3 comments
Closed

Debug CRA Tests stopped working on v1.19 #40293

amadeogallardo opened this issue Dec 15, 2017 · 3 comments
Assignees
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues

Comments

@amadeogallardo
Copy link

amadeogallardo commented Dec 15, 2017

  • VSCode Version: 1.19
  • OS Version: Windows 10

Steps to Reproduce:

  1. Setup a launch configuration as described here: https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#debugging-tests-in-visual-studio-code
  2. Fire the debugger with F5 or play on the debugging panel
  3. The debugger doesn't start the test scripts and eventually fires a timeout
  4. Rollback to version 1.18
  5. Follow steps 1-2
  6. The debugger starts the test scripts and properly attaches to the debugger

Note: the changelog for 1.19 mentions new additions on the debugging experience: https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#debugging-tests-in-visual-studio-code

I'll post the same issue on Create React App since it seems to be tightly related:
facebook/create-react-app#3602

Reproduces without extensions: Yes

@vscodebot vscodebot bot added the debug Debug viewlet, configurations, breakpoints, adapter issues label Dec 15, 2017
@isidorn isidorn assigned weinand and unassigned isidorn Dec 15, 2017
@weinand
Copy link
Contributor

weinand commented Dec 15, 2017

The launch config at https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#debugging-tests-in-visual-studio-code is wrong (but it worked by accident because VS Code had a bug in previous versions).

  • don't use an "--inspect-brk" since VS Code inserts that automatically based on the node.js version being used.
  • "test" is not a runtime argument and belongs into the "args" array.

Just try this:

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

@amadeogallardo
Copy link
Author

Thanks for the swift response @weinand. The configuration above worked fine with VS Code 1.19.
I'll update the related issue on Create React App to update the documentation accordingly.

@weinand
Copy link
Contributor

weinand commented Dec 15, 2017

@amadeogallardo that configuration should work fine for all versions of VS Code.

amadeogallardo added a commit to amadeogallardo/create-react-app that referenced this issue Dec 15, 2017
The launch configuration code provided is not compatible with VSCode since version 1.19.
The proposed documentation change is based on the response by a VSCode team member.

References:
facebook#3602 (comment)
microsoft/vscode#40293 (comment)
Timer pushed a commit to facebook/create-react-app that referenced this issue Dec 18, 2017
The launch configuration code provided is not compatible with VSCode since version 1.19.
The proposed documentation change is based on the response by a VSCode team member.

References:
#3602 (comment)
microsoft/vscode#40293 (comment)
@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 29, 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
Projects
None yet
Development

No branches or pull requests

3 participants