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

How do I debug a failing test without enabling stop on "all exceptions?" #463

Open
ELLIOTTCABLE opened this issue Jun 14, 2019 · 1 comment

Comments

@ELLIOTTCABLE
Copy link

Environment

  1. node -v: v10.12.0

  2. npm -v: 6.9.0

  3. npm ls jest: jest@23.5.0

  4. your vscode-jest settings if customized:

    • jest.pathToJest? blank
    • jest.pathToConfig? blank
  5. Operating system: macOS 10.14.5

Prerequisite

  • are you able to run jest test from command line? yes

  • how do you run your tests from command line? (for example: npm run test or node_modules/.bin/jest) copy-paste the line executed by vscode-jest:

    cd /Users/ec/Sync/Code/excmd ; env CI=vscode-jest-tests /Users/ec/.nodenv/shims/node --inspect-brk=14995 node_modules/jest/bin/jest.js --runInBand parser.test.js --testNamePattern "parses a single command"

Relevant Debug Info

The only line in the Inspector console that appears to be jest-related:

spawning process with command=/Users/ec/Sync/Code/excmd/node_modules/.bin/jest, args=--json,--useStderr,--outputFile,/var/folders/xt/wm01x2h50nv993t_csb1t5qm0000gn/T/jest_runner.json,--watch,--no-color

(Unrelatedly: Every other output appears to be self-annotated by the relevant plugin with its' plugin-name; maybe add [jest] … to your log-lines?)

Here's my launch.json configuration:

{
   "type": "node",
   "name": "vscode-jest-tests",
   "request": "launch",
   "args": ["--runInBand"],
   "cwd": "${workspaceFolder}",
   "console": "integratedTerminal",
   "internalConsoleOptions": "neverOpen",
   "program": "${workspaceFolder}/node_modules/jest/bin/jest.js"
}

Expected Behavior

Clicking the ‘debug’ annotation on a broken test would launch a debugger, which then would stop executing at that test, or possibly on the exception generated during that test, even with “all exceptions”

Actual Behavior

I must be missing something, because without enabling stopping on caught exceptions, I just see the tests running in the debugger output, and then the process exits … and if I do turn on stop on caught exceptions (“all exceptions” in VScode), which can't be necessary (!?), then the debugger stops on a billion low-level Node control-flow constructs involving module-loading within Jest itself.

Screen Shot 2019-06-14 at 10 01 29

I'm assuming this is user-error, but I can't figure out what I've configured incorrectly. How do I simply debug one failing test?

@connectdotz
Copy link
Collaborator

did you set a breakpoint and the debugger just didn't stop?

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

No branches or pull requests

2 participants