-
Notifications
You must be signed in to change notification settings - Fork 33
Confused about cleanup
#205
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
Comments
I think I know what is going on. In your first test, you render two components. And if I understand how the cache that gets cleared after a test works, it expects only one and -- when you actually render twice -- the second render clobbers the entry of the first in the cache, resulting in it not being cleared. Hence the leftover button that messed up test number 2. I think I know how to solve this. Hopefully a patch will come something during the week. |
The way the cache was set up, we could only have one render element per test. Which, mind you, is the most common use-case, but it can create surprises. Fixes #205
The way the cache was set up, we could only have one render element per test. Which, mind you, is the most common use-case, but it can create surprises. Fixes #205
🎉 This issue has been resolved in version 3.2.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
👋 I just started learning
testing-library
, I really like it so far!I don't understand how cleanup works, from the docs:
My expectation is that tests are isolated, so if I render a component in a test, that component is destroyed (cleaned up?) at the end of the test. But I see a different behavior.
Comp.svelte
comp.test.ts
The test suite fails with the following message:
As far as I understand, the components in the first test are still in the DOM. I tried to manually call
cleanup
but I got the same result. I also don't seeHello There
.What am I doing wrong?
The text was updated successfully, but these errors were encountered: