-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
singapore/gl-got
#20Description
The following works in 0.18.2
:
test(t => {
t.notThrows(new Promise(resolve => {
setTimeout(() => {
t.pass();
resolve();
}, 100);
}));
});
On master, it fails with:
Assertion passed, but test has already ended
We should wait until all pending assertions have resolved before declaring a test "finished" and throwing when new assertions show up.
Adding a call to t.plan()
causes it to behave oddly going all the way back (we even added a test solidifying this odd behavior in #360):
test(t => {
t.notThrows(new Promise(resolve => {
t.plan(2);
setTimeout(() => {
t.pass();
resolve();
}, 100);
}));
});
The above fails with:
Planned for 2 assertions, but got 1.
Similar results for as far back as I tested.
I think we should allow for added assertions, as long as we still have pending assertions. When t.plan
is used, I don't think we should check for too few assertions until we've drained all pending assertions.
Metadata
Metadata
Assignees
Labels
No labels