cleanup warnings are fired even if cleanup is fired manually
@testing-library/reactversion: 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):
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
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).
This change will be reverted in an upcoming patch release :)