-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Render stops working when running multiple test suites #1251
Comments
From further investigation, I realized this problem seems to only occur with So to make things work for me, I'll remove Now that I know |
We released a fix in 0.12.0. @zrev2220 Can you confirm it is working now? |
@sheremet-va The issue where the
However, I fixed this by adding a call to Given this fact, I guess this issue can probably be closed, though the non-auto |
I suspect it is referencing another cjs/esm entry point, although not sure. Deserves another open issue. I think cleanup function is not called for other frameworks too. |
@sheremet-va Just now got around to it, but I opened #1430 for the non-auto |
Describe the bug
I have a project with multiple test suites, each of which call
render
and other@testing-library/react
things to test React components. When running all test suites, the first one will succeed, while the others will fail when doing something along the lines ofscreen.getByText
, failing with aTestingLibraryElementError
. Here's example error output:You can see in this output that the document is only
<body />
, hence why the requested element isn't found.Interestingly (frustratingly?), if I add
screen.debug()
statements prior to this assertion, the document tree contains all the expected elements. 😕 So for some reasonscreen.getByText
isn't using the same tree asscreen.debug
prints.Reproduction
See https://github.com/zrev2220/vitest-render-bug.
Tests fail when running
npm test
(ornpm run test
), but succeed when run individually vianpm run test -- Counter
andnpm run test -- DarkMode
.System Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: