{
            "type": "node",
            "request": "launch",
            "name": "Mocha Current File",
            "program": "${workspaceFolder}/node_modules/.bin/_mocha",   ⇐ “_mocha” NOT “mocha”
            "runtimeArgs": [
                "--nolazy",
                "--max_old_space_size=16384",
                "--preserve-symlinks"    <=== Important. Related with way of resolving module by node.
            ],
            "args": [
                "-r",
                "ts-node/register",
                "--no-timeouts",
                "--colors",
                "src/index.spec.ts"
            ],
            "outFiles": [
                "${workspaceFolder}/build"  <=== This is very important NOT "${workspaceFolder}/build/**/*.js"
            ],
            "console": "integratedTerminal",
            "sourceMaps": true,
            "skipFiles": [
                "node_modules/**/*.js",
                "<node_internals>/**/*.js"
            ],
            "internalConsoleOptions": "neverOpen"
        }


<IMPORTANT NOTE>

if “program” is “ts” file; then
    outFiles: ["${workspaceFolder}/build/**/*.js"]
else if “program” is other executable using ‘ts-node/register’; then
    outFiles SHOULD be removed.
fi

*** In case of Mocha, if ‘outFiles’ are described, breakpoint cannot be reached!

+ Recent posts