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

cleanup warnings are fired even if cleanup is fired manually #1253

Closed
cloud-walker opened this issue Nov 17, 2023 · 2 comments · Fixed by #1255
Closed

cleanup warnings are fired even if cleanup is fired manually #1253

cloud-walker opened this issue Nov 17, 2023 · 2 comments · Fixed by #1255

Comments

@cloud-walker
Copy link

  • @testing-library/react version: 14.1
  • Testing Framework and version: Vitest 0.34
  • DOM Environment: jsdom

The v14.1 introduced a warning (#1244 ), that is yelling on my vitest based tests (notice that both warnings are fired):

image

I know about the cleanup thing and I use it manually as said by the docs, and I don't expect this warning to appear.

I've also tried the "STL_SKIP_AUTO_CLEANUP" envvar (typo in the docs, it should be RLT_), but it seems to not work, and feels weird to have to add an envvar to mute a warning

@tmkn
Copy link

tmkn commented Nov 17, 2023

Same, here using vitest with a setupFiles: "./tests/setup.ts" entry where I call cleanup manually:

import { afterEach } from "vitest";
import { cleanup } from "@testing-library/react";
import "@testing-library/jest-dom/vitest";

// runs a cleanup after each test case (e.g. clearing jsdom)
afterEach(() => {
    cleanup();
});

Yet I get spammed with the above messages, which is wrong as I manually call cleanup.
It's only if I disable the setupFiles entry that my tests are failing (which is expected as my cleanup is not called any more).

@MatanBobi
Copy link
Member

This change will be reverted in an upcoming patch release :)

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

Successfully merging a pull request may close this issue.

3 participants