Skip to content

debugger; and breakpoints don't work with node --inspect #1652

@snapwich

Description

@snapwich

Currently breakpoints can be set for use with node debug using the keyword debugger;, but any breakpoints set with debugger; when using node --inspect are ignored. This only applies to the test code; breakpoints set with debugger; within Jest or other node_module libraries are honored.

I set up a test repository to demonstrate the difference: https://github.com/snapwich/jest-inspect. Both methods can be tested by pulling the repo and running the following:

npm install

// works
node debug --debug-brk ./node_modules/.bin/jest -i

// doesn't honor "debugger;"
node --inspect --debug-brk ./node_modules/.bin/jest -i

Also, after the initial run-through with node --inspect, breakpoints can be applied to the code in the Sources tab. Any breakpoints placed in test code (such as __tests__/jest.js in jest-inspect repo above) will be ignored, but breakpoints placed in any other files (Jest or other node_modules code) will work correctly when the suite is rerun.

node --inspect is only available in node v6.3.0+ and I'm running on OSX using node v6.4.0 and npm v3.10.3

/cc @kentcdodds

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions