Test timeout: async test did not complete
Quick summary
Your test timed out — an async operation or promise did not resolve or reject within the timeout period.
Why this happens
An async operation in the test never resolves because the underlying promise is not settled
The test waits for an event or condition that never occurs due to a logic error
The test timeout is set too low for legitimate slow operations like network requests
Minimal example
test('fetches user data', async () => {
const promise = fetchUser(1); // missing await
expect(promise.name).toBe('John'); // promise is not resolved — timeout
});test('fetches user data', async () => {
const user = await fetchUser(1);
expect(user.name).toBe('John');
});Adding the missing await keyword ensures the promise is resolved before the assertion runs, preventing the timeout.
How to diagnose
Check if the test has unawaited promises or missing await keywords
Review the test for operations that depend on external resources that may be unavailable
Increase the timeout temporarily to see if the test eventually passes
How to fix
Add missing await keywords to all async operations in the test
Mock external dependencies so the test does not wait on real network or I/O
Increase the test timeout with test.timeout() or a per-test timeout option
How to prevent
Always await all promises in async tests and use lint rules to catch missing await
Mock external dependencies in unit tests to avoid real I/O and network delays
Related Resources
Related Lessons
- Async Testing
Learn about async tests.