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", "name": "ig-test",
"version": "1.3.1", "version": "1.3.2",
"description": "experimental test runner....", "description": "experimental test runner....",
"main": "test.js", "main": "test.js",
"bin": { "bin": {

24
test.js
View File

@ -27,11 +27,21 @@ var argv = require('ig-argv')
// | <path> // | <path>
// | [ <path>, .. ] // | [ <path>, .. ]
// //
// XXX need to skip ./node_modules...
module.DEFAULT_TEST_FILES = '**/?(*-)test.js' module.DEFAULT_TEST_FILES = '**/?(*-)test.js'
//
// IGNORE_TEST_FILES =
// undefined
// | [ <path>, .. ]
//
module.IGNORE_TEST_FILES = ['node_modules/**'] module.IGNORE_TEST_FILES = ['node_modules/**']
//
// VERBOSE = <bool>
//
//
// NOTE: to test in verbose mode do: // NOTE: to test in verbose mode do:
// $ VERBOSE=1 npm test // $ VERBOSE=1 npm test
// or // or
@ -277,9 +287,7 @@ object.Constructor('Tests', Merged, {})
// default blank pass-through... // default blank pass-through...
// NOTE: we need at least one modifier and at least one test for the // NOTE: we need at least one modifier and at least one test for the
// system to run.... // system to run....
.add({ '-': function(_, s){ .add({ '-': function(_, s){ return s }})
console.log('--------------')
return s }})
var Cases = var Cases =
@ -525,8 +533,8 @@ argv.Parser({
// search... // search...
glob.sync(path, { glob.sync(path, {
ignore: this.ignore_files ignore: this.ignore_files
|| module.IGNORE_TEST_FILES, || module.IGNORE_TEST_FILES
}) || [], })
: [path]) : [path])
// load the modules... // load the modules...
.forEach(function(path){ .forEach(function(path){
@ -534,6 +542,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)
// 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)) }) }) }},
@ -549,7 +558,8 @@ argv.Parser({
collect: 'list', collect: 'list',
default: function(){ default: function(){
return this.ignore_files return this.ignore_files
|| module.IGNORE_TEST_FILES } }, || module.IGNORE_TEST_FILES
|| [] } },
'-verbose': { '-verbose': {