Skip to content

Commit fbb7205

Browse files
committed
fixup! Clean up collecting and running tests
1 parent be04edf commit fbb7205

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

test/runner.js

+9-8
Original file line numberDiff line numberDiff line change
@@ -387,29 +387,30 @@ test('options.bail will bail out', t => {
387387
test('options.bail will bail out (async)', t => {
388388
t.plan(1);
389389

390-
const tests = [];
391-
return promiseEnd(new Runner({bail: true}), runner => {
390+
let bailed = false;
391+
promiseEnd(new Runner({bail: true}), runner => {
392392
runner.chain.cb('cb', a => {
393393
setTimeout(() => {
394-
tests.push(1);
395394
a.fail();
396395
a.end();
397396
}, 100);
398397
a.pass();
399398
});
400399

400+
// Note that because the first test is asynchronous, the second test is
401+
// run and the `setTimeout` call still occurs. The runner should end though
402+
// as soon as the first test fails.
403+
// See the `bail + serial` test below for comparison
401404
runner.chain.cb('cb 2', a => {
402405
setTimeout(() => {
403-
tests.push(2);
406+
t.true(bailed);
407+
t.end();
404408
a.end();
405409
}, 300);
406410
a.pass();
407411
});
408412
}).then(() => {
409-
t.strictDeepEqual(tests, [1]);
410-
// Note that the second `setTimeout` call still occurs, but the test run
411-
// ends as soon as the first test fails.
412-
// See the `bail + serial` test below for comparison
413+
bailed = true;
413414
});
414415
});
415416

0 commit comments

Comments
 (0)