samedi 21 janvier 2017

How to bind to event with Mocha CLI

If you use mocha programatically you can do the following:

// Run the tests.
mocha.run(function(failures){
    process.on('exit', function () {
        process.exit(failures);  // exit with non-zero status if there were failures
   });
});

However, when you run your tests like

$> ./node_modules/.bin/mocha ./test/foo.spec.js

How can I do the same thing as above?

Aucun commentaire:

Enregistrer un commentaire