happy-dom
happy-dom copied to clipboard
Jest environment could detect some errors it is currently silencing
The following tests will not show any error when using happy-dom environment:
test('leak microtask', () => {
queueMicrotask(() => expect(1).toBe(2));
});
test('leak timer', () => {
setTimeout(() => expect(1).toBe(2), 1000);
});
It would be nice if the environment could detect pending timers or flush (until timeout) when torn down.
This could be achieved with something like await this.global.happyDOM.waitUntilComplete()
in the teardown.
I'll be happy to help with a PR.
Cf. https://github.com/jestjs/jest/issues/14984