Interview practice question
Tests pass alone but fail when run together
Frontend Engineering · Testing and Tooling · Intermediate
Some tests pass when run individually but fail when the whole suite runs. What's happening, and how would you fix it?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Shared state leaking between tests.
- Mocks not reset; global modifications.
- Leftover DOM, timers, storage.
- Reset in afterEach; restoreMocks config.
- Run in random order to detect.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.