From 86e76d80fbabcc73a757923d451c0971bad851cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=2EAzer=20Ko=C3=A7ulu?= Date: Mon, 11 Feb 2013 03:25:26 -0800 Subject: [PATCH] before & after --- lib/testsuite.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/testsuite.js b/lib/testsuite.js index 79f0be1..b1169e0 100644 --- a/lib/testsuite.js +++ b/lib/testsuite.js @@ -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){ @@ -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; } @@ -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); }); }