Skip to content

test: Leaking test #884

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

Closed
ph-fritsche opened this issue Jan 31, 2021 · 1 comment
Closed

test: Leaking test #884

ph-fritsche opened this issue Jan 31, 2021 · 1 comment

Comments

@ph-fritsche
Copy link
Member

  • @testing-library/dom version: master = v7.29.4

Relevant code or config:

This test leaks setTimeout so that tests added below are not run by jest.

test('should not use realTimers when timers are not faked with useFakeTimers', () => {

What you did:

Added tests for a pull request.

What happened:

Jest fails to setTimeout for subsequent tests.
Adding a describe block with test, the tests are ignored without error messages.
Adding a describe block with test.only reveals the problem.

Suggested solution:

Enclose the tests in a describe block and define beforeAll/afterEach to properly clean up after the test.

@eps1lon
Copy link
Member

eps1lon commented Feb 1, 2021

Good catch. A PR would be appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants