调试node服务
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}/src/app.js",
"runtimeExecutable": "yarn",
"runtimeArgs": [
"start"
],
"restart": true,
"console": "integratedTerminal",
"skipFiles": [
"${workspaceFolder}/node_modules/**/*.js"
]
}
]
}
支持es6的mocha测试
- sourceMaps开启,才能让调试位置不发生偏移
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Mocha Tests",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": [
"test/reverseKGroup.spec.js",
"--require",
"@babel/register"
],
"cwd": "${workspaceRoot}",
"sourceMaps": true,
"env": {
"BABEL_ENV": "debug"
}
}
]
}
支持es6调试
需要安装@babel/core,@babel/node,@babel/preset-env,@babel/register
// ,vscode/launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "babel",
"program": "",
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/babel-node",
"sourceMaps": true,
"env": {
"BABEL_ENV": "debug"
}
}
]
}
//.babelrc
{
"presets": [
"@babel/preset-env"
],
"env": {
"debug": {
"sourceMaps": "inline",
"retainLines": true
}
}
}
网友评论