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)

Upvotes: 0

Views: 684

Answers (1)

Federico
Federico

Reputation: 86

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

VS Code breakpoints selector

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.

Upvotes: 3

Related Questions