Skip to content

Commit ba74cbf

Browse files
committed
fix: supertape: runTests: parseTime
1 parent e65f228 commit ba74cbf

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

packages/supertape/lib/run-tests.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ const tryToCatch = require('try-to-catch');
66
const isDebug = require('./is-debug');
77

88
const {createValidator} = require('./validator');
9-
const isString = (a) => typeof a === 'string';
9+
1010
const inc = wraptile((store) => store(store() + 1));
1111
const isOnly = ({only}) => only;
1212
const isSkip = ({skip}) => skip;
1313
const notSkip = ({skip}) => !skip;
14-
const parseTime = (a) => isString(a) ? 1 : a;
14+
const parseTime = (a) => a === 'undefined' ? 1 : a;
1515

1616
const getInitOperators = async () => await import('./operators.mjs');
1717

@@ -193,3 +193,5 @@ async function runOneTest(options) {
193193
failed: failed(),
194194
});
195195
}
196+
197+
module.exports.parseTime = parseTime;

packages/supertape/lib/run-tests.spec.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const montag = require('montag');
77
const mockRequire = require('mock-require');
88
const pullout = require('pullout');
99

10+
const {parseTime} = require('./run-tests');
1011
const {test, stub} = require('..');
1112

1213
const {reRequire, stopAll} = mockRequire;
@@ -907,3 +908,19 @@ test('supertape: runTests: is debug', async (t) => {
907908
t.equal(result, expected);
908909
t.end();
909910
});
911+
912+
test('supertape: runTests: parseTimeundefined', (t) => {
913+
const result = parseTime('undefined');
914+
const expected = 1;
915+
916+
t.equal(result, expected);
917+
t.end();
918+
});
919+
920+
test('supertape: runTests: parseTime', (t) => {
921+
const result = parseTime('1000');
922+
const expected = '1000';
923+
924+
t.equal(result, expected);
925+
t.end();
926+
});

0 commit comments

Comments
 (0)