如何在Nodeunit中显示完整的堆栈跟踪?
当nodeunit捕获错误时,如何显示完整的堆栈跟踪? 例如,我的testing是抛出:
✔ event delete - basic ✔ delete - errors Fatal error: undefined is not a function
如何让nodeunit告诉我undefined
被调用的地方?
问题在于grunt-contrib-nodeunit:它将原始的nodeunit消息修改成不太有用的东西。 我在这里创build了一个问题。
简而言之,我用grunt-contrib-nodeunit生成的代码如下:
user@desktop:~/bug_test$ grunt Running "nodeunit:all" (nodeunit) task test.js Fatal error: undefined is not a function
普通的nodeunit提供了一个更有帮助的错误信息:
user@desktop:~/bug_test$ nodeunit test.js test.js FAILURES: Undone tests (or their setups/teardowns): - testSomethingElse To fix this, make sure all tests call test.done()
而且,如问题所示,当有一个堆栈共享grunt-contrib-nodeunit时,有时会隐藏它。
请注意,记者的select(咕噜,默认或最小)并没有什么不同。
解决方法是,只要得到不太有用的错误消息,就总是直接使用nodeunit运行testing。 可能有新的信息。