added ignore paths...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2020-08-16 00:58:43 +03:00
parent f5cebf4c43
commit a207c74e98
2 changed files with 20 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "ig-test", "name": "ig-test",
"version": "1.2.3", "version": "1.3.0",
"description": "experimental test runner....", "description": "experimental test runner....",
"main": "test.js", "main": "test.js",
"bin": { "bin": {
@ -27,6 +27,6 @@
"colors": "^1.4.0", "colors": "^1.4.0",
"glob": "^7.1.6", "glob": "^7.1.6",
"ig-argv": "^2.13.0", "ig-argv": "^2.13.0",
"ig-object": "^5.2.2" "ig-object": "^5.2.6"
} }
} }

19
test.js
View File

@ -27,7 +27,9 @@ 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'
module.IGNORE_TEST_FILES = ['node_modules/**']
// NOTE: to test in verbose mode do: // NOTE: to test in verbose mode do:
@ -519,7 +521,10 @@ argv.Parser({
.forEach(function(path){ .forEach(function(path){
;(path.includes('*') ? ;(path.includes('*') ?
// search... // search...
glob.sync(path, {}) glob.sync(path, {
ignore: this.ignore_files
|| module.IGNORE_TEST_FILES,
})
: [path]) : [path])
// load the modules... // load the modules...
.forEach(function(path){ .forEach(function(path){
@ -532,6 +537,18 @@ argv.Parser({
require('./' + path.slice(0, -3)) }) }) }}, require('./' + path.slice(0, -3)) }) }) }},
ignore_files: undefined,
'-i': '-ignore',
'-ignore': {
doc: 'path/pattern to ignore in test file search',
arg: 'PATH | ignore_files',
collect: 'list',
default: function(){
return this.ignore_files
|| module.IGNORE_TEST_FILES } },
'-verbose': { '-verbose': {
doc: 'verbose mode', doc: 'verbose mode',
env: 'VERBOSE', env: 'VERBOSE',