From afb0a097844ba52d9da9a01533652e4f48e8becb Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Thu, 24 Jul 2014 01:11:55 -0400 Subject: [PATCH] Test case now allows for short-hand require of SUT --- test/inc-testcase.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/test/inc-testcase.js b/test/inc-testcase.js index 0cab4f0..056dbea 100644 --- a/test/inc-testcase.js +++ b/test/inc-testcase.js @@ -81,15 +81,29 @@ function incAssertCount() * This will be evolving throughout the life of the project. Mainly, it cannot * be run as part of a suite without multiple summary outputs. * - * @param {Object.} object containing tests + * @param {string|Object.} SUT module path; or object + * containing tests + * + * @param {Object.=} object containing tests, if first + * argument is provided * * @return {undefined} */ -module.exports = function( test_case ) +module.exports = function( _, __ ) { + var args = Array.prototype.slice.call( arguments ), + test_case = args.pop(), + sutpath = args.pop(); + var context = prepareCaseContext(), setUp = test_case.setUp; + // automatically include SUT if its module path was provided + if ( sutpath ) + { + context.Sut = common_require( sutpath ); + } + // if we're not running a suite, clear out the failures if ( !( suite ) ) {