Sharing data between test suites. #7519
-
car.js
test-file1.js
test-file2.js
In javascript when you import instance of a class in multiple places, you will get that same instance because of module caching. Because vitest uses worker threads and runs each test file separately every import is a new instance. What is the recommended approach for sharing an instance or any other variables across multiple vitest test files? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
That's not recommended at all. All test files should be isolated from each other and work without each other. |
Beta Was this translation helpful? Give feedback.
Actually this sounds exactly like the use case for global setup and then passing the result to test runners with
provide
.