From b911ee0bae362cbc04ea7c683c448935d4445427 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Fri, 11 Sep 2020 21:49:06 +0300 Subject: [PATCH] now all test blocks support other stuff than functions... Signed-off-by: Alex A. Naanou --- package.json | 4 ++-- test.js | 25 +++++++++++++------------ 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index c7d96f6..49e615a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ig-test", - "version": "1.4.3", + "version": "1.4.4", "description": "experimental test runner....", "main": "test.js", "bin": { @@ -26,7 +26,7 @@ "dependencies": { "colors": "^1.4.0", "glob": "^7.1.6", - "ig-argv": "^2.13.0", + "ig-argv": "^2.13.2", "ig-object": "^5.2.6" } } diff --git a/test.js b/test.js index 62b0a23..500b41f 100644 --- a/test.js +++ b/test.js @@ -455,28 +455,28 @@ function(spec, chain, stats){ chain_length != 1 && object.deepKeys(tests) .filter(function(t, i, l){ - return ( + return typeof(tests[t]) == 'function' // skip blank tests if we have other tests unless // explicitly specified... - (t == '-' - && test != t - && l.length > 1) ? - false - : (test == '*' - || test == t) ) }) + && ((t == '-' + && test != t + && l.length > 1) ? + false + : (test == '*' + || test == t) ) }) .forEach(function(t){ // modifiers... object.deepKeys(modifiers) .filter(function(m){ - return mod == '*' || mod == m }) + return typeof(modifiers[m]) == 'function' + && (mod == '*' || mod == m) }) .forEach(function(m){ // setups... object.deepKeys(setups) .filter(function(s){ - return setup == '*' || setup == s }) + return typeof(setups[s]) == 'function' + && (setup == '*' || setup == s) }) .forEach(function(s){ - if(typeof(setups[s]) != 'function'){ - return } // run the test... stats.tests += 1 var _assert = assert.push( @@ -492,7 +492,8 @@ function(spec, chain, stats){ chain_length <= 1 && Object.keys(cases) .filter(function(s){ - return setup == '*' || setup == s }) + return typeof(cases[s]) == 'function' + && (setup == '*' || setup == s) }) .forEach(function(c){ stats.tests += 1 cases[c]( assert.push(c) ) })