I have mocha tests. I will simplify as possible as I can. I wonder how should I handle the errors in mocha tests. For example, if there is an error in getName, what should I do? How can I throw an error? Or should I use done(error)
as;
it('trial', function(done) {
getName(function (name, err) {
if(err){
done(err); //what should I do here?
}else{
console.log(name);
}
});
});
Aucun commentaire:
Enregistrer un commentaire