Search code examples
node.jsvisual-studio-codejestjsyarnpkg

In VS Code why does Yarn debug stop at cli.js when Caught Exceptions is enabled?


I'm trying to debug a Jest test and breakpoint at "Caught Exceptions" in VS Code but it stops at /.node/corepack/yarn/1.22.15/lib/cli.js which is irrelevant to me.

I've tried to add several paths to skipFiles in launch.json but no luck so far.

How can I ignore the Yarn/node core files?

VS Code breakpoints at Caught Exceptions

Launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "name": "vscode-jest-tests.v2",
            "request": "launch",
            "runtimeExecutable": "yarn",
            "runtimeVersion": "16.13.2",
            "program": "jest",
            "args": [
                "--runInBand",
                "--watchAll=false",
                "--testNamePattern",
                "${jest.testNamePattern}",
                "--runTestsByPath",
                "${jest.testFile}"
            ],
            "cwd": "${workspaceFolder}/next/",
            "console": "integratedTerminal",
            "internalConsoleOptions": "neverOpen",
            "windows": {
                "program": "jest"
            },
            "skipFiles": [
                "<node_internals>/**/*.js",
                "~/.node/**/*.js",
                "**/.yarn/**",
                "**/node_modules/**",
                "**/yarn/**",
             ]
        },
    ]
}



Solution

  • Adding **/.node/corepack/yarn/** made it ignore those files.

                "skipFiles": [
                    "<node_internals>/**",
                    "**/node_modules/**",
                    "**/.node/corepack/yarn/**"
                 ]