Skip to content

Glossary: Testing Web Apps

afterEach

Also written: beforeEach

Vitest functions that run a piece of code after (`afterEach`) or before (`beforeEach`) every test in a file. `afterEach` is commonly used for cleanup, such as removing rendered components or resetting mock request handlers.

Where the book teaches it

Related terms

cleanupSetup filebeforeAll