Isolated DB

πŸ‘¨β€πŸ’Ό Alright, we have an issue when we run all the tests at once. We need to remember that our test files all run in parallel. This will cause problems if they're using the same test database because they'll conflict when they try to delete users between tests and even the entire test database when they're done!
So we need to make sure each test gets its own test database. Luckily, Vitest gives us a special environment variable to uniquely identify each test process called VITEST_POOL_ID which is an incrementing number. So we can update our databaseFile to include that in the database filename to keep them from colliding.
Now you can run all the tests at once. If you watch carefully, you should be able to notice the test databases being created and deleted.
npx vitest

Access Denied

You must login or register for the workshop to view the diff.

Check out this video to see how the diff tab works.