To debug mocha.js in vscode select run & debug
If you dont have launch.json file press create a launch.json file for creating it.
Select Mocha Tests
The json should looks like:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"args": [
"-u",
"tdd",
"--timeout",
"999999",
"--colors",
"${workspaceFolder}/test"
],
"internalConsoleOptions": "openOnSessionStart",
"name": "Mocha Tests",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"request": "launch",
"skipFiles": [
"<node_internals>/**"
],
"type": "pwa-node"
},
{
"type": "pwa-node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [
"<node_internals>/**"
],
"program": "${file}"
}
]
}
Add to "args":
"--file",
"${workspaceFolder}/test-folder/setup.js",
"${workspaceFolder}/test-folder/**/*.spec.js",
If you get Process exited with code 1 remove the
"--require",
"esm",
Top comments (0)