【发布时间】:2018-08-20 19:42:05
【问题描述】:
当我使用 Electron 时,我无法在 VS Code 中调试我的 Jest 测试。我的测试应该使用 Electron,而不是 Node(由于使用了本地模块)。
{
"name": "Jest Unit Tests",
"type": "node",
"request": "launch",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron",
"program": "${workspaceRoot}/node_modules/.bin/jest",
"windows": {
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd"
},
"env": {
"ELECTRON_RUN_AS_NODE": "1",
"NODE_ENV": "test",
"BABEL_DISABLE_CACHE": "1"
},
"args": [
"-i",
"--verbose",
"-c test/config/jest.unit.json"
],
"internalConsoleOptions": "openOnSessionStart"
},
它基于用于使用 Node 调试 Jest 的常用配置(效果很好),但我无法让它与 Electron 一起使用。 Jest 命令是正确的,但是 VSCode 添加的--debug-brk --inspect 选项似乎与 Jest 混淆了。
【问题讨论】:
-
你有没有想过这个问题?我自己也遇到了同样的问题
-
不抱歉,我没有在这个项目中使用调试器。不过,使用 Node 进行调试通常就足够了,除了特定的 Electron 代码。
标签: debugging visual-studio-code jestjs electron vscode-debugger