Global setup/teardown functions for all tests in watch mode #6719
-
In Vitest, we have several options for running setup and teardown functions:
I'm looking for a way to run specific functions at the very beginning and end of all tests, like with a global setup, but also in watch mode, meaning:
Is there an existing feature in Vitest that can achieve this behavior? (I found this discussion that seems to ask the same question as me, but got no answers) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Currently the only way to run a custom code when Vitest triggers a rerun is with a custom reporter's |
Beta Was this translation helpful? Give feedback.
Currently the only way to run a custom code when Vitest triggers a rerun is with a custom reporter's
onWatcherRerun
. We are planning to add the same hook to the global setup in the future: #6417 (comment)