test hooks

Functions a test runner calls around tests, such as beforeEach to set up fresh data and afterEach to clean it up.

In more detail

Hooks keep tests independent, so one test cannot leave behind state that breaks the next. before and after hooks run once for a whole suite rather than around each test.

Related terms

Taught in

References