运行 带有 mocha 的节点检查器
Run node inspector with mocha
我似乎无法调试 mocha 脚本。
我可以 运行 像这样 node --inspect script.js
与检查员打交道。然后这给了我一个 url 去调试,比如 chrome-devtools://devtools/remote/...
但是,当我在这一行中使用 mocha 时 mocha --inspect test.js
我无法调试。它说 'Debugger listening on [::]:5858'。我有什么办法可以使用节点的检查器调试 mocha 测试吗?
去localhost:5858给我这个信息:
Type: connect
V8-Version: 5.1.281.84
Protocol-Version: 1
Embedding-Host: node v6.9.1
Content-Length: 0
使用 --inspect --debug-brk
没有帮助。
问题出在我的 mocha 版本上。我使用的是 运行 早于 3.1.0 的版本。 --inspect
在 3.1.0
中添加了支持
我现在可以 运行 使用这些行进行调试:
mocha --reporter spec --inspect test.js
mocha --reporter spec --inspect-brk test.js
[DEP0062] DeprecationWarning: node --inspect --debug-brk
is
deprecated. Please use node --inspect-brk
instead.
将来使用
mocha --reporter spec --inspect-brk test.js
我似乎无法调试 mocha 脚本。
我可以 运行 像这样 node --inspect script.js
与检查员打交道。然后这给了我一个 url 去调试,比如 chrome-devtools://devtools/remote/...
但是,当我在这一行中使用 mocha 时 mocha --inspect test.js
我无法调试。它说 'Debugger listening on [::]:5858'。我有什么办法可以使用节点的检查器调试 mocha 测试吗?
去localhost:5858给我这个信息:
Type: connect
V8-Version: 5.1.281.84
Protocol-Version: 1
Embedding-Host: node v6.9.1
Content-Length: 0
使用 --inspect --debug-brk
没有帮助。
问题出在我的 mocha 版本上。我使用的是 运行 早于 3.1.0 的版本。 --inspect
在 3.1.0
我现在可以 运行 使用这些行进行调试:
mocha --reporter spec --inspect test.js
mocha --reporter spec --inspect-brk test.js
[DEP0062] DeprecationWarning:
node --inspect --debug-brk
is deprecated. Please usenode --inspect-brk
instead.
将来使用
mocha --reporter spec --inspect-brk test.js