在 nativescript 中调试 Mocha 测试

Debug a Mocha test in nativescript

我希望能够使用 VS Code 调试 Mocha 测试。但是,如果我 运行:

tns test -ios --debug-brk

我收到错误消息:

You cannot use --watch and --debug-brk simultaneously. Remove one of the flags and try again.

我目前使用的是最新的 nativescript-cli。

是否可以使用 VS Code 在 NativeScript 中调试 Mocha 测试?

从 NativeScript CLI 2.5.0 版本开始,watch 选项默认设置为 true。看起来这会破坏 test 命令中的 --debug-brk 选项。您可以通过将 watch 选项设置为 false 来绕过它。为了实现这一点,只需执行: $ tns test ios --debug-brk --no-watch