简体   繁体   中英

Jest Test Visual Studio Code Debugger Throws “Error No Such a File” Exception

I am trying to use Jest with Visual Studio Code with debugger. My launch file is:

{
  "version": "0.2.0",
  "configurations": [
    {
      "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"
    }
  ]
}

When I start runner, it throws that exception:

Exception has occurred: Error Error: ENOENT: no such file or directory, stat '**/*.(ts|tsx)' at Object.statSync (fs.js:932:3) at typeSync (/Users/can/code/new-mail/node_modules/path-type/index.js:27:16) at /Users/can/code/new-mail/node_modules/dir-glob/index.js:46:48 at Array.map () at module.exports.sync (/Users/can/code/new-mail/node_modules/dir-glob/index.js:46:30) at globDirs (/Users/can/code/new-mail/node_modules/globby/index.js:58:9) at getPattern (/Users/can/code/new-mail/node_modules/globby/index.js:61:64) at /Users/can/code/new-mail/node_modules/globby/index.js:107:19 at Array.reduce () at module.exports.sync (/Users/can/code/new-mail/node_modules/globby/index.js:106:26)

Make sure the filter selector for breakpoints in VS Code does not include Caught Exceptions :

VS Code 断点选择器

That would make the debugger stop for any exception, even if it's handled properly, and even if it happens in an external package and not in your code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM