mirror of
https://github.com/harish2704/simple-mocha.git
synced 2026-09-10 06:21:08 +00:00
Fix Error management.
This commit is contained in:
@@ -53,12 +53,13 @@ Task.prototype.exec = function(_cb){
|
||||
};
|
||||
|
||||
this.startTime = Date.now();
|
||||
if( this.isAsync ){
|
||||
return this.fn(cb);
|
||||
}
|
||||
try{
|
||||
if( this.isAsync ){
|
||||
this.fn(cb);
|
||||
} else {
|
||||
this.fn();
|
||||
cb();
|
||||
}
|
||||
} catch(e){
|
||||
cb(e);
|
||||
}
|
||||
@@ -76,7 +77,12 @@ Task.prototype.print = function(){
|
||||
);
|
||||
|
||||
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 );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"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.",
|
||||
"author": "Harish.K<harish2704@gmail.com>",
|
||||
"license": "MIT",
|
||||
|
||||
Reference in New Issue
Block a user