Skip to content

Commit

Permalink
before & after
Browse files Browse the repository at this point in the history
  • Loading branch information
E.Azer Koçulu committed Feb 11, 2013
1 parent 7b4a856 commit 86e76d8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/testsuite.js
Expand Up @@ -85,12 +85,12 @@ function initArgs(testsuite){
var args = undefined;

function callInit(callback){
if(typeof testsuite.options.module.init != 'function'){
if(typeof testsuite.options.module.init != 'function' && typeof testsuite.options.module.before != 'function'){
callback();
return;
}

testsuite.options.module.init(testsuite.options, callback);
( testsuite.options.module.init || testsuite.options.module.before )(testsuite.options, callback);
};

return function(callback){
Expand Down Expand Up @@ -121,7 +121,7 @@ function filterTestFunctions(el){
function newFinish(testsuite){

function end(callback){
if( testsuite.options.module.end == undefined ){
if( testsuite.options.module.end == undefined && testsuite.options.module.after == undefined ){
callback();
return;
}
Expand All @@ -130,7 +130,7 @@ function newFinish(testsuite){
var args = [].concat(initArgs);
args.push(callback);

testsuite.options.module.end.apply(undefined, args);
( testsuite.options.module.after || testsuite.options.module.end ).apply(undefined, args);
});
}

Expand Down

0 comments on commit 86e76d8

Please sign in to comment.