In case of promise is NOT fullfilled forever, mocha doens't give any information about this.
See test below.

    describe('test', function () {
        it('test', async () => {
            await new Promise((r, j) => {});
            console.log('hello');
        });
    })

This gives only following result in terminal

    test
      test
Waiting for the debugger to disconnect...
Killed

No more informations!

블로그 이미지

yhcting

Tag mocha, test

댓글을 달아 주세요

        {
            "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!

블로그 이미지

yhcting

댓글을 달아 주세요