Browse Source

Fix Error management.

refactor
Harish.K 10 years ago
parent
commit
83cb1e0c46
  1. 18
      index.js
  2. 2
      package.json

18
index.js

@ -53,12 +53,13 @@ Task.prototype.exec = function(_cb){
}; };
this.startTime = Date.now(); this.startTime = Date.now();
if( this.isAsync ){
return this.fn(cb);
}
try{ try{
this.fn();
cb();
if( this.isAsync ){
this.fn(cb);
} else {
this.fn();
cb();
}
} catch(e){ } catch(e){
cb(e); cb(e);
} }
@ -76,7 +77,12 @@ Task.prototype.print = function(){
); );
if( this.err ){ if( this.err ){
console.log( this.err.stack );
if(this.err instanceof Error ){
// console.log( this.err.stack );
console.log( this.err );
}else{
console.log( this.err );
}
} }
}; };

2
package.json

@ -1,6 +1,6 @@
{ {
"name": "simple-mocha", "name": "simple-mocha",
"version": "0.0.3",
"version": "0.0.4",
"description": "Simple stupid implementation of Mocha test runner. Tests can be run directly within node as any Nodejs code.", "description": "Simple stupid implementation of Mocha test runner. Tests can be run directly within node as any Nodejs code.",
"author": "Harish.K<harish2704@gmail.com>", "author": "Harish.K<harish2704@gmail.com>",
"license": "MIT", "license": "MIT",

Loading…
Cancel
Save