cleanup...

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

View File

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

24
test.js
View File

@ -27,11 +27,21 @@ var argv = require('ig-argv')
// | <path>
// | [ <path>, .. ]
//
// XXX need to skip ./node_modules...
module.DEFAULT_TEST_FILES = '**/?(*-)test.js'
//
// IGNORE_TEST_FILES =
// undefined
// | [ <path>, .. ]
//
module.IGNORE_TEST_FILES = ['node_modules/**']
//
// VERBOSE = <bool>
//
//
// NOTE: to test in verbose mode do:
// $ VERBOSE=1 npm test
// or
@ -277,9 +287,7 @@ object.Constructor('Tests', Merged, {})
// default blank pass-through...
// NOTE: we need at least one modifier and at least one test for the
// system to run....
.add({ '-': function(_, s){
console.log('--------------')
return s }})
.add({ '-': function(_, s){ return s }})
var Cases =
@ -525,8 +533,8 @@ argv.Parser({
// search...
glob.sync(path, {
ignore: this.ignore_files
|| module.IGNORE_TEST_FILES,
})
|| module.IGNORE_TEST_FILES
|| [], })
: [path])
// load the modules...
.forEach(function(path){
@ -534,6 +542,7 @@ argv.Parser({
if(!/.*\.js$/.test(path)){
throw argv.ParserError(
`${key}: only support .js modules, got: "${path}"`) }
console.log('found module:', path)
// XXX should we handle the load error here???
that.test_modules[path] =
require(process.cwd() +'/'+ path.slice(0, -3)) }) }) }},
@ -549,7 +558,8 @@ argv.Parser({
collect: 'list',
default: function(){
return this.ignore_files
|| module.IGNORE_TEST_FILES } },
|| module.IGNORE_TEST_FILES
|| [] } },
'-verbose': {