Skip to content

Commit 7ffc043

Browse files
committed
Add some more tests regarding async assertions and t.plan
1 parent 1dc4551 commit 7ffc043

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/test.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,3 +459,19 @@ test('number of assertions matches t.plan when the test exits, but before all pr
459459
t.end();
460460
})
461461
});
462+
463+
test('number of assertions doesn\'t t.plan when the test exits, but before all promises resolve another is added', function (t) {
464+
ava(function (a) {
465+
a.plan(3);
466+
a.throws(delay(Promise.reject(new Error('foo')), 10), 'foo');
467+
a.doesNotThrow(delay(Promise.resolve(), 10), 'foo');
468+
setTimeout(function () {
469+
a.throws(Promise.reject(new Error('foo')), 'foo');
470+
}, 5);
471+
}).run().catch(function(err) {
472+
t.is(err.operator, 'plan');
473+
t.is(err.actual, 2);
474+
t.is(err.expected, 3);
475+
t.end();
476+
});
477+
});

0 commit comments

Comments
 (0)