Testing · Junior · Question 22 of 78
What is beforeEach used for?
- ✓Correct answer: Running setup code before every test in the current scope, so each test starts from a clean state
- 2Running code once before all tests in the file
- 3Choosing the order in which tests run
Explanation
For one-time setup there is beforeAll; for cleanup - afterEach and afterAll.