Open
Description
The following code:
var test = require('tape');
test('first', function (t) {
t.plan(2);
setTimeout(function () {
t.ok(1, 'first test');
}, 200);
t.test('second', function (t) {
t.ok(1, 'second test');
t.end();
});
});
test('third', function (t) {
setTimeout(function () {
t.ok(1, 'third test');
t.end();
}, 100);
});
outputs:
ok 1 first test
ok 2 second test
ok 3 third test
and it's expected. But if I change it to its logical equivalent without plan
:
var test = require('tape');
test('first', function (t) {
setTimeout(function () {
t.ok(1, 'first test');
t.end();
}, 200);
t.test('second', function (t) {
t.ok(1, 'second test');
t.end();
});
});
test('third', function (t) {
setTimeout(function () {
t.ok(1, 'third test');
t.end();
}, 100);
});
the the test order is broken:
ok 1 second test
ok 2 third test
ok 3 first test
While changing the order of the first and the second test is somewhat expected, ending the first test prematurely, and letting the third test execute before it, looks like a bug. Especially considering that commenting t.test('second'...
test out restores the expected order, and make the third test wait until the first one ends.