vendredi 29 janvier 2016

How to stop mocha instance started programatically

Is there anyway other way than process.exit() to stop a Mocha instance that was started programmatically?

I run mocha in code something like this:

var mocha = new Mocha({
   'reporter' : 'custom-reporter'
});

mocha.run(function(failures){
    console.log('done');
    // this will make the test stop everything...
    // process.exit()
});

Stopping it with process.exit() works, but that terminates everything... if there is still some processes running in the custom reporter that terminates as well. I need a better way to stop the Mocha instance. Is there an alternative approach?

Aucun commentaire:

Enregistrer un commentaire