How can I test async running code with vitest and use beforeEach and afterEach to setup and teardown resources? #7615
Unanswered
nsulzberger
asked this question in
Q&A
Replies: 1 comment 3 replies
-
Yes. Use
This sounds serial to me. Use |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We have a lot of async running code in our repo we would like to test.
Our test suite looks like this:
What I have learned is that our async called tests are not running serially as far as I can see. Test1 is starting first, and immediately test2 is starting afterwards while test 1 is still running. So afterEach() running after test1 is tearing down resources which should be available in test2, so test2 is failing.
Is this behavior expected, or are we doing something wrong in our code in test1 and test2. As both tests are using the same iframe, and so the components sometimes gets added twice to the iframe, they break.
Beta Was this translation helpful? Give feedback.
All reactions