Replies: 1 comment 1 reply
-
HI @flowt-au .. did you find a solution to this? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want to reseed my database via an API call before any test files run. I have tried all the various combinations of globalSetup, setupFiles, beforeAll(), beforeEach(), etc and cannot seem to get this working.
I start my tests with the following script:
"test:unit": "vitest"
viayarn test:unit
. The tests run and the watcher kicks in. The globalSetup file runs the first time I do that, but each time I press 'r', or change a file that triggers "RERUN", globalSetup does not run again.As per the docs, the setupFile runs before each test file, and globalThis seems to be reset for each file so setting a flag to say "you have already reseeded the db" wont work.
So, what is the way to run some code before any test files run and whenever the RERUN is triggered? I must be missing something obvious here but cannot see what.
Thanks,
Murray
Beta Was this translation helpful? Give feedback.
All reactions