Jest cannot log after tests are done
Asynchronous work continued after Jest considered the test complete and attempted to write output later.
RECOGNIZABLE ERROR
Cannot log after tests are done. Did you forget to wait for something asyncRANKED DIAGNOSIS
What usually causes it
- 01
A promise was not returned or awaited
The test function ends before the asynchronous branch settles.
DIAGNOSE
Find unawaited calls and callbacks that create promises in the failing test.
FIX
Return or await the promise and assert after it resolves.
- 02
A timer or subscription was not cleaned up
Intervals, event listeners, or observers remain active after teardown.
DIAGNOSE
Run with open-handle detection and inspect created timers and subscriptions.
FIX
Clear timers and unsubscribe in afterEach or the component cleanup path.
- 03
A mocked callback fires after teardown
The mock schedule outlives the test's expected lifecycle.
DIAGNOSE
Inspect fake timers, delayed callbacks, and pending request mocks.
FIX
Flush the intended work or cancel it before restoring mocks.
Prevent the repeat
- →Await every async user journey.
- →Clean up timers and subscriptions.
- →Treat open handles as test failures.
Primary references
Run this against your evidence
The browser triage workflow uses the same stable pattern slug and does not upload your paste.