1
0
Fork 0

Test case now allows for short-hand require of SUT

protolib
Mike Gerwitz 2014-07-24 01:11:55 -04:00
parent 1458d79ee1
commit afb0a09784
No known key found for this signature in database
GPG Key ID: F22BB8158EE30EAB
1 changed files with 16 additions and 2 deletions

View File

@ -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.<string,function()>} object containing tests
* @param {string|Object.<string,function()>} SUT module path; or object
* containing tests
*
* @param {Object.<string,function()>=} 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 ) )
{