摩卡单位testing返回0作为未捕获的exception退出代码

我有我的当前应用程序的testing套件。

有时我会引入一个错误,并导致一个未被捕获的exception被抛出。

手动运行unit testing时,可以看到错误。 但是,当我将它与我们的CI系统集成时,该过程仍然返回0,就好像一切正​​常。

由于这个正面的退出码,我们无法检测到错误。 我究竟做错了什么?

我终于修复了这个问题,感谢nodeJS域名:

这是我的testing/ server.coffee,在那里我设置了testing:

d = require("domain").create() # set up error handling to exit with error code on uncaught exceptions d.on "error", (err) -> console.log "Uncaught Exception:", err.message console.log err.stack process.exit(1) before (done) -> d.run -> # bootstrap application done() 

这捕获所有的错误,打印跟踪和退出状态1退出。