bugfix...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2020-08-16 05:17:20 +03:00
parent 214fef4514
commit c68f30cf99
2 changed files with 14 additions and 8 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "ig-test", "name": "ig-test",
"version": "1.3.2", "version": "1.3.3",
"description": "experimental test runner....", "description": "experimental test runner....",
"main": "test.js", "main": "test.js",
"bin": { "bin": {

20
test.js
View File

@ -11,6 +11,7 @@
(function(require){ var module={} // make module AMD/node compatible... (function(require){ var module={} // make module AMD/node compatible...
/*********************************************************************/ /*********************************************************************/
var path = require('path')
var colors = require('colors') var colors = require('colors')
var glob = require('glob') var glob = require('glob')
@ -542,7 +543,7 @@ argv.Parser({
if(!/.*\.js$/.test(path)){ if(!/.*\.js$/.test(path)){
throw argv.ParserError( throw argv.ParserError(
`${key}: only support .js modules, got: "${path}"`) } `${key}: only support .js modules, got: "${path}"`) }
console.log('found module:', path) console.log('Loading module:', path)
// XXX should we handle the load error here??? // XXX should we handle the load error here???
that.test_modules[path] = that.test_modules[path] =
require(process.cwd() +'/'+ path.slice(0, -3)) }) }) }}, require(process.cwd() +'/'+ path.slice(0, -3)) }) }) }},
@ -611,13 +612,18 @@ function(default_files, tests){
tests = default_files tests = default_files
default_files = undefined } default_files = undefined }
// patch require.cache to make the clients load the global module...
var local = path.join(process.cwd(), 'node_modules', 'ig-test', 'test.js')
require.cache[local] = require.cache[require.main.filename]
var stats = {} var stats = {}
var tests = tests || { var tests = tests
setups: Setups, || {
modifiers: Modifiers, setups: Setups,
tests: Tests, modifiers: Modifiers,
cases: Cases, tests: Tests,
} cases: Cases,
}
var p = Object.assign( var p = Object.assign(
Object.create(parser), Object.create(parser),
tests, tests,