【发布时间】:2018-09-16 21:46:35
【问题描述】:
使用正确的调试配置文件,我可以让 VSCode 通过 Mocha 运行当前关注的文件。但是,如果我正在处理实际代码而不是规范文件并按F5,它会尝试通过 Mocha 将实际代码作为规范文件运行。
所以,我的问题是;给定这样的文件结构:
Folder
File.js
File.spec.js
还有一个像这样的调试配置 (.vscode/launch.json):
{
// 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": [
{
"type": "node",
"request": "launch",
"name": "Unit Tests: Current File",
"program": "${workspaceRoot}/node_modules/.bin/_mocha",
"cwd": "${workspaceRoot}",
"args": [
"-u", "tdd",
"--timeout=999999",
"--colors",
"--opts", "${workspaceRoot}/mocha.opts",
"${file}" // I want to make this dynamic
],
}
]
}
无论选择spec文件(File.spec.js)还是它的主题(File.js),是否可以让VSCode调试spec文件?
【问题讨论】:
标签: visual-studio-code vscode-debugger