Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jest environment could detect some errors it is currently silencing #1345

Open
yjaaidi opened this issue Mar 21, 2024 · 0 comments
Open

Jest environment could detect some errors it is currently silencing #1345

yjaaidi opened this issue Mar 21, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@yjaaidi
Copy link

yjaaidi commented Mar 21, 2024

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. jestjs/jest#14984

@yjaaidi yjaaidi added the enhancement New feature or request label Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant