diff --git a/test/test-member_builder-method.js b/test/test-member_builder-method.js index c5c711d..5ada826 100644 --- a/test/test-member_builder-method.js +++ b/test/test-member_builder-method.js @@ -24,7 +24,7 @@ var common = require( './common' ), assert = require( 'assert' ), - mb_common = require( './inc-member_builder-common' ) + mb_common = require( __dirname + '/inc-member_builder-common' ) ; mb_common.value = function() {}; diff --git a/test/test-member_builder-prop.js b/test/test-member_builder-prop.js index 57b829f..1953a36 100644 --- a/test/test-member_builder-prop.js +++ b/test/test-member_builder-prop.js @@ -24,7 +24,7 @@ var common = require( './common' ), assert = require( 'assert' ), - mb_common = require( './inc-member_builder-common' ) + mb_common = require( __dirname + '/inc-member_builder-common' ) ; mb_common.value = { bar: 'baz' }; diff --git a/tools/combine b/tools/combine index 49c756d..e6cd1b4 100755 --- a/tools/combine +++ b/tools/combine @@ -99,32 +99,38 @@ if [ "$INC_TEST" ]; then # note that not all tests are included TEST_CASES=$( find $PATH_TEST \ \( -name 'test-*.js' \ - -name 'inc-*.js' \ - ! -name 'test-combine.js' \ - ! -name 'test-index.js' \ + -o -name 'inc-*.js' \ \) \ -exec basename {} \; \ + | sort \ + | grep -v 'test-\(combine\|index\).js' \ ) # include test combine template cat "$TPL_TEST_PATH" | grep -v '^#' | $RMTRAIL echo "/** TEST CASES **/" - echo "ns_exports.runTests = function ()" + echo "ns_exports.runTests = function()" echo "{" for testcase in $TEST_CASES; do filename="$PATH_TEST/$testcase" + # generate the module name by removing path and extension, then + # prefixing it with "test/" + module="${filename%.*}" + module="test/${module##*/}" + # each module must be enclosed in a closure to emulate a module echo "/** TEST CASE: $testcase **/" - echo "( function()" + echo "( function( module, __dirname )" echo "{" + echo " var exports = module.exports = {};" # add the module, removing trailing commas cat $filename | $RMTRAIL - echo "} )();" + echo "} )( module['$module'] = {}, 'test' );" done echo "};"