I have a test suite for my current app.
Sometimes I introduce an error and this results in an uncaught exception that is thrown.
I can see the error when running the unit tests manually. But when I integrate this with our CI system, the process still returns 0 as if everything was ok.
Because of this positive exit code we can't detect errors. What am I doing wrong?
I finally fixed this issue, thanks to nodeJS domains:
This is my test/server.coffee, where I set the tests up:
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()
This catches all the errors, prints the trace and exits with exit status 1.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With