Testing · Middle · Question 42 of 75
Why do Jest and Vitest isolate test files by default?
- ✓Correct answer: Each file gets its own module registry and environment, so state from one file doesn't leak into another
- 2To run files alphabetically
- 3To allow only one test per file
Explanation
Inside one file, state is shared between tests - reset it in hooks.