vscode debug ES6 application

后端 未结 9 749
小鲜肉
小鲜肉 2020-12-24 02:44

I have VSCode 0.5.0. I set the compilerOptions flag to \"ES6\" and the editor started recognizing my ES6 code as correct. I have babel installed. My Mocha tests use the bab

9条回答
  •  南笙
    南笙 (楼主)
    2020-12-24 02:55

    This is my configuration and it works great! I am using the VSCode debugging, mocha 6.1.4, node: v8.16.0, and Babel version 6.

    Make sure to load babel-register and babel-polyfill in runtimeArgs, or else you will get regeneratorRuntime is not defined!

    {
        "type": "node",
        "request": "launch",
        "name": "Mocha test debug",
        "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/mocha",
        "console": "integratedTerminal",
        "internalConsoleOptions": "neverOpen",
        "protocol": "inspector",
        "stopOnEntry": false,
        "runtimeArgs": [
            "--nolazy",
            "--require",
            "babel-register",
            "--require",
            "babel-polyfill",
            "tests/*.js"
        ],
        "sourceMaps": true
    }
    

提交回复
热议问题