Description
Environment
vscode-jest version
: 4.1.2node -v
: v16.9.1npm -v
oryarn --version
: npm 7.21.1npm ls jest
ornpm ls react-scripts
(if you haven’t ejected): [email protected]- your vscode-jest settings if customized:
- jest.jestCommandLine? ???
- jest.autoRun? ???
- anything else that you think might be relevant? I tried installing, uninstalling, reinstalling various test frameworks and they did not work as expected
- Operating system: Windows 10
package.json:
{
"dependencies": {
"bitbucket": "^2.6.3",
"fast-xml-parser-ordered": "^3.12.22",
"global-agent": "^3.0.0",
"global-tunnel": "^1.2.0",
"node-stringbuilder": "^2.2.6",
"yargs": "^17.2.1"
},
"scripts": {
"test": "jest"
},
"devDependencies": {
"jest": "^27.2.4"
}
}
Prerequisite
- are you able to run jest test from the command line? Yes, but sometimes it runs but does not give a test result.
- how do you run your tests from the command line? npm run test
Steps to Reproduce
Just make an empty repo with one jest test and try to debug it with all exceptions enabled.
Relevant Debug Info
Expected Behavior
No exceptions during start of debugging or some way to limit debugging to certain area.
Any suggestions would be welcome, as at this point I am not sure if node JS is acting up.
Actual Behavior
I want to debug tests in VS Code. For that I need to break on exceptions, but, AFAIK there is no way to tell the debugger to skip the test framework and only break on exceptions from certain own modules or files. This is trivial in Visual Studio by limiting exception types or modules, or by disabling external code, but in VS Code I don't see where to do it.
It almost feels like jest relies on exceptions as a messaging mechanism, which it shouldn't. Maybe this aspect can be handled in vscode-jest somehow?
These are the exceptions happening at every start:
Exception has occurred: Error: ENOENT: no such file or directory, stat '...\node_modules\jest\bin\package.json'
at statSync (node:fs:1536:3)
at AsyncFunction.module.exports.sync (...\node_modules\locate-path\index.js:57:17)
at runMatcher (...\node_modules\find-up\index.js:54:22)
at AsyncFunction.module.exports.sync (...\node_modules\find-up\index.js:67:21)
at AsyncFunction.module.exports.sync (...\node_modules\pkg-dir\index.js:15:26)
at module.exports (...\node_modules\import-local\index.js:7:27)
at Object.<anonymous> (...\node_modules\jest\bin\jest.js:11:6)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
Exception has occurred: Error: ENOENT: no such file or directory, stat '...\node_modules\jest-cli\bin\package.json'
at statSync (node:fs:1536:3)
at AsyncFunction.module.exports.sync (...\node_modules\locate-path\index.js:57:17)
at runMatcher (...\node_modules\find-up\index.js:54:22)
at AsyncFunction.module.exports.sync (...\node_modules\find-up\index.js:67:21)
at AsyncFunction.module.exports.sync (...\node_modules\pkg-dir\index.js:15:26)
at module.exports (...\node_modules\import-local\index.js:7:27)
at Object.<anonymous> (...\node_modules\jest-cli\bin\jest.js:11:6)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
Exception has occurred: Error: ENOENT: no such file or directory, stat '...\node_modules\jest-environment-...\node_modules\jest-environment-node\build'
at Object.statSync (node:fs:1536:3)
at Object.statSync (...\node_modules\graceful-fs\polyfills.js:312:16)
at statSyncCached (...\node_modules\jest-resolve\build\defaultResolver.js:147:17)
at isDirectory (...\node_modules\jest-resolve\build\defaultResolver.js:210:10)
at loadNodeModulesSync (...\node_modules\resolve\lib\sync.js:191:17)
at resolveSync (...\node_modules\resolve\lib\sync.js:98:17)
at defaultResolver (...\node_modules\jest-resolve\build\defaultResolver.js:108:38)
at Function.findNodeModule (...\node_modules\jest-resolve\build\resolver.js:191:14)
at resolveWithPrefix (...\node_modules\jest-resolve\build\utils.js:135:34)
at resolveTestEnvironment (...\node_modules\jest-resolve\build\utils.js:184:3)
Exception has occurred: Error: ENOENT: no such file or directory, stat '...\node_modules\jest-environment-...\node_modules\jest-environment-node\build'
at Object.statSync (node:fs:1536:3)
at Object.statSync (...\node_modules\graceful-fs\polyfills.js:312:16)
at statSyncCached (...\node_modules\jest-resolve\build\defaultResolver.js:147:17)
at isDirectory (...\node_modules\jest-resolve\build\defaultResolver.js:210:10)
at loadNodeModulesSync (...\node_modules\resolve\lib\sync.js:191:17)
at resolveSync (...\node_modules\resolve\lib\sync.js:98:17)
at defaultResolver (...\node_modules\jest-resolve\build\defaultResolver.js:108:38)
at Function.findNodeModule (...\node_modules\jest-resolve\build\resolver.js:191:14)
at resolveWithPrefix (...\node_modules\jest-resolve\build\utils.js:135:34)
at resolveTestEnvironment (...\node_modules\jest-resolve\build\utils.js:184:3)
...
This is not just these 4 exceptions, but it just keeps going and going and going...
Is this just my machine?