Testing · Middle · Question 40 of 75
What is a setup file (setupFiles in Vitest, setupFilesAfterEnv in Jest) used for?
- ✓Correct answer: Shared setup for every test file: jest-dom matchers, MSW server, polyfills, global mocks
- 2Listing which tests to run
- 3Building the app before tests
Explanation
Jest's setupFilesAfterEnv runs after the test framework is installed, so expect.extend and hooks like afterEach are available there.