We call queue.kill to stop the test queue. Unfortunately, this removes
the drain function. We previously used it to properly exit the
process. So, instead, we wrap the onTaskComplete callback inside a new
onTaskComplete callback. This latter adds the process.exit code in
case errors have occured.
We do that this way because it must run after the last report has been
written. Keep in mind that everything is asynchronous.
We call
queue.kill
to stop the test queue. Unfortunately, this removes thedrain
function. We previously used it to properly exit the process. So, instead, we wrap theonTaskComplete
callback inside a newonTaskComplete
callback. This latter adds theprocess.exit
code in case errors have occured.We do that this way because it must run after the last report has been written. Keep in mind that everything is asynchronous.