Running Mocha tests compiled with Babel in Visual Studio Code

后端 未结 1 877
情书的邮戳
情书的邮戳 2021-02-08 15:54

I am using Babel in my Mocha tests. To run the test in terminal I use following command:

mocha --debug --compilers js:babel/register

Then I can

相关标签:
1条回答
  • 2021-02-08 16:30

    I got mocha running with babel locally using this config:

    "configurations": [
        {
            "name": "Debug Mocha",
            "type": "node",
            "program": "./node_modules/.bin/_mocha",
            "stopOnEntry": false,
            "args": ["--compilers", "js:babel-register"],
            "cwd": ".",
            "runtimeExecutable": null,
            "runtimeArgs": [
                "--nolazy"
            ],
            "env": {
                "NODE_ENV": "development"
            },
            "externalConsole": false,
            "sourceMaps": true,
            "outDir": null
        },
        {
            "name": "Attach",
            "type": "node",
            "request": "attach",
            "port": 5858
        }
    ]
    

    Which uses the _mocha executable since node is already invoked by Code. Also, make sure you have sourceMaps set to true.

    0 讨论(0)
提交回复
热议问题