diff --git a/testing.js b/testing.js index 1855fe8..377eecc 100644 --- a/testing.js +++ b/testing.js @@ -539,7 +539,11 @@ export const fails = f => { * @param {Object>>} tests */ export const runTests = async tests => { - const numberOfTests = object.map(tests, mod => object.map(mod, f => /* istanbul ignore next */ f ? 1 : 0).reduce(math.add, 0)).reduce(math.add, 0) + /** + * @param {string} testname + */ + const filterTest = testname => testname.startsWith('test') || testname.startsWith('benchmark') + const numberOfTests = object.map(tests, mod => object.map(mod, (f, fname) => /* istanbul ignore next */ f && filterTest(fname) ? 1 : 0).reduce(math.add, 0)).reduce(math.add, 0) let successfulTests = 0 let testnumber = 0 const start = performance.now() @@ -548,7 +552,7 @@ export const runTests = async tests => { for (const fname in mod) { const f = mod[fname] /* istanbul ignore else */ - if (f) { + if (f && filterTest(fname)) { const repeatEachTest = 1 let success = true for (let i = 0; success && i < repeatEachTest; i++) { diff --git a/testing.test.js b/testing.test.js index 6276bfb..0741ff5 100644 --- a/testing.test.js +++ b/testing.test.js @@ -4,6 +4,11 @@ import * as buffer from './buffer.js' import * as map from './map.js' import * as promise from './promise.js' +/* istanbul ignore next */ +export const nottestingNotTested = () => { + t.assert(false, 'This test should not be executed because the name doesnt start with "test"') +} + /** * @param {t.TestCase} tc */