Open MartinHelmut opened 5 years ago
An easier example of this behaviour is the following test suite:
// src/__tests__/long-running.test.js
const { describe, execute } = require("../runner");
describe("with long running unit tests", async (assert) => {
assert({
given: "first test for long running tests",
should: "execute before 'a long running unit test'",
actual: true,
expected: true,
});
assert({
given: "a long running unit test",
should: "resolve in order to the other tests",
actual: await execute(() => {
return new Promise((resolve) => {
setTimeout(() => resolve(true), 1000);
});
}),
expected: true,
});
assert({
given: "second test for long running tests",
should: "execute after 'a long running unit test'",
actual: true,
expected: true,
});
});
There are async tests failing with no obvious reason behind. A
@todo
comment was placed here: https://github.com/krieselreihe/natr/blob/master/src/__tests__/duplex-stream.test.js#L36The following both tests kind of result in a timeout internally that will result in setting the test suite pointer to the next item and therefore adding the result messages to the wrong queue.
Wrong test output:
Correct test output:
Here the tests that cause the issue: