`node --inspect-brk jest --runInBand --watch` doesn't stop on breakpoint or debugger statement.
See original GitHub issueš Bug Report
node --inspect-brk jest --runInBand --watch
doesnāt stop on breakpoints or debugger statement whereas
node --inspect-brk jest --runInBand
will (no --watch flag)
Noe: It is using ts-jest 23.0.0
jest.config.js
module.exports = {
globals: {
"ts-jest": {
skipBabel: true,
enableTsDiagnostics: true,
disableSourceMapSupport: true
}
},
roots: [
"<rootDir>/src",
"<rootDir>/tests"
],
transform: {
"^.+\\.tsx?$": "ts-jest"
},
testRegex: "(/tests/.*.(test|spec)).ts$",
moduleFileExtensions: [
"js",
"ts",
"json",
"node"
],
setupTestFrameworkScriptFile: "jest-extended",
verbose: true
};
Expected behavior
I would expect debugging to work with --watch
Run npx envinfo --preset jest
it errors with
(node:2536) UnhandledPromiseRejectionWarning: TypeError: Cannot read property '1' of null
node --version
v10.0.0
jest version
23.4.0
Thanks
Issue Analytics
- State:
- Created 5 years ago
- Reactions:31
- Comments:38 (12 by maintainers)
Top Results From Across the Web
Troubleshooting - Jest
When Jest executes the test that contains the debugger statement, execution will pause and you can examine the current scope and call stack....
Read more >How do you debug Jest Tests? - Stack Overflow
Open the command palette and start Debug: JavaScript Debug Terminal : ... node --inspect-brk <path to jest.js> --runInBand <path to yourĀ ...
Read more >Jest Configuration And Debugging Jest Based Tests
Use the below command to execute the test in a breakpoint mode. /usr/local/bin/node --inspect-brk ./node_modules/jest/bin/jest.js --runInBand. #Ā ...
Read more >7 Ways to Debug Jest Tests in Terminal - Pragmatic Pineapple
Put a debugger statement somewhere in your code (testing or production one). Run node --inspect-brk node_modules/.bin/jest --runInBand [anyĀ ...
Read more >Debug Jest Tests - YouTube
Here we'll cover how you can run your jest tests in Chrome's DevTools using node -- inspect - brk. Sometimes it's just really...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I started having trouble again after downgrading to 23.1.0, and after pulling some hair out I got things to work reliably by using
--no-cache
when invoking Jest. This also seems to solve the problem with the latest Jest release too. Itās not clear to me why just downgrading Jest to the version that had been working reliably before didnāt work, but there are so many moving parts that have changed in last few weeks (VS Code version, typescript, jest, ts-jest) I assume there are other things involved.I tried the following:
Breakpoints are unverified. Debugging doesnāt work at all
Breakpoints are verified. Stops on breakpoints the first run only. After changing something resulting in tests restarting, vscode still shows verified breakpoints, but the debugger doesnāt work any more.
Seems to work reliably.
So thereās something wrong with the way sourcemaps are cached, apparently, and it isnāt just old/invalid cached information lying around from an older version of something, since clearing the cache only results in it working once.
Ran into this, took about 5 hours thinking my VSCode was malfunctioning. If anyone else has a workflow of running jest in watch mode, then using VSCode to āAttach by Process IDā, I recommend modifying your command line to: