Angular tests: Error: Expected to be running in 'ProxyZone', but it was not found.
fakeAsync / waitForAsync was used, but the test environment's zone testing setup is missing.
Expected to be running in 'ProxyZone', but it was not foundExpected to be running in 'ProxyZone'ProxyZone fakeAsyncError: Expected to be running in 'ProxyZone', but it was not found. Meaning
fakeAsync needs zone.js/testing loaded. With Karma the CLI does it; with Jest you need jest-preset-angular and a setup-jest.ts importing it. Also happens when zone.js testing is imported twice, or tests run outside the Angular test runner.
Common causes
zone.js/testingnot imported (Jest withoutsetup-jest.ts)jest-preset-angularmissing or misconfigured- Using
fakeAsyncin a plain function outsideit() - Mixed Zone.js versions
- Test runner replaced without Angular's polyfills
⚡ Quick fix
- Create
setup-jest.tswithimport 'jest-preset-angular/setup-jest';and reference it in the Jest config - Use the preset:
preset: 'jest-preset-angular' - Call
fakeAsynconly insideit/beforeEach
Detailed fix by platform
npm
npm i -D jest jest-preset-angular @types/jest- jest.config.js:
{ preset: 'jest-preset-angular', setupFilesAfterEach: ['<rootDir>/setup-jest.ts'] }(older: setupFilesAfterEnv)
Code examples
Jest setup
// setup-jest.ts
import 'jest-preset-angular/setup-jest';
// jest.config.js
module.exports = { preset: 'jest-preset-angular', setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'] };How to diagnose
- Runner — Karma or Jest?
- Setup — zone.js/testing loaded?
- Usage — fakeAsync inside an it block?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- Cannot find control with name Angular: Error: Cannot find control with name: 'email' (reactive forms)
- Component is not resolved: templateUrl Angular tests: Component 'X' is not resolved: templateUrl: ./x.component.html — Did you run and wait for 'resolveComponentResources()'?
- Could not find the builder's node package Angular CLI: Could not find the '@angular-devkit/build-angular:browser' builder's node package / Cannot find module '@angular-devkit/build-angular/package.json'
Most viewed in Angular
Other ways to find it
Where this error sits
Origin: On your device. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 15 Oct 2026