now all test blocks support other stuff than functions...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2020-09-11 21:49:06 +03:00
parent 090ba740be
commit b911ee0bae
2 changed files with 15 additions and 14 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "ig-test", "name": "ig-test",
"version": "1.4.3", "version": "1.4.4",
"description": "experimental test runner....", "description": "experimental test runner....",
"main": "test.js", "main": "test.js",
"bin": { "bin": {
@ -26,7 +26,7 @@
"dependencies": { "dependencies": {
"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.2",
"ig-object": "^5.2.6" "ig-object": "^5.2.6"
} }
} }

25
test.js
View File

@ -455,28 +455,28 @@ function(spec, chain, stats){
chain_length != 1 chain_length != 1
&& object.deepKeys(tests) && object.deepKeys(tests)
.filter(function(t, i, l){ .filter(function(t, i, l){
return ( return typeof(tests[t]) == 'function'
// skip blank tests if we have other tests unless // skip blank tests if we have other tests unless
// explicitly specified... // explicitly specified...
(t == '-' && ((t == '-'
&& test != t && test != t
&& l.length > 1) ? && l.length > 1) ?
false false
: (test == '*' : (test == '*'
|| test == t) ) }) || test == t) ) })
.forEach(function(t){ .forEach(function(t){
// modifiers... // modifiers...
object.deepKeys(modifiers) object.deepKeys(modifiers)
.filter(function(m){ .filter(function(m){
return mod == '*' || mod == m }) return typeof(modifiers[m]) == 'function'
&& (mod == '*' || mod == m) })
.forEach(function(m){ .forEach(function(m){
// setups... // setups...
object.deepKeys(setups) object.deepKeys(setups)
.filter(function(s){ .filter(function(s){
return setup == '*' || setup == s }) return typeof(setups[s]) == 'function'
&& (setup == '*' || setup == s) })
.forEach(function(s){ .forEach(function(s){
if(typeof(setups[s]) != 'function'){
return }
// run the test... // run the test...
stats.tests += 1 stats.tests += 1
var _assert = assert.push( var _assert = assert.push(
@ -492,7 +492,8 @@ function(spec, chain, stats){
chain_length <= 1 chain_length <= 1
&& Object.keys(cases) && Object.keys(cases)
.filter(function(s){ .filter(function(s){
return setup == '*' || setup == s }) return typeof(cases[s]) == 'function'
&& (setup == '*' || setup == s) })
.forEach(function(c){ .forEach(function(c){
stats.tests += 1 stats.tests += 1
cases[c]( assert.push(c) ) }) cases[c]( assert.push(c) ) })