angular/angular · error · Error
Only globals are patched with zone-testing. If you import `i
Error message
Only globals are patched with zone-testing. If you import `it`, `describe`, etc. directly, you cannot use `fakeAsync` or `waitForAsync`.
What it means
Error "Only globals are patched with zone-testing. If you import `it`, `describe`, etc. directly, you cannot use `fakeAsync` or `waitForAsync`." thrown in angular/angular.
Source
Thrown at packages/zone.js/lib/zone-spec/proxy.ts:16
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {ZoneType} from '../zone-impl';
declare let jest: any;
export function throwProxyZoneError(): never {
const jestPatched = typeof jest !== 'undefined' && jest['__zone_patch__'];
if (jestPatched) {
throw new Error(
'Only globals are patched with zone-testing. If you import `it`, `describe`, etc. directly, you cannot use `fakeAsync` or `waitForAsync`.',
);
} else {
throw new Error(
'ProxyZoneSpec is needed for the fakeAsync and waitForAsync test helpers but could not be found. ' +
'Make sure that your environment includes zone-testing.js',
);
}
}
export class ProxyZoneSpec implements ZoneSpec {
name: string = 'ProxyZone';
private _delegateSpec: ZoneSpec | null = null;
properties: {[k: string]: any} = {'ProxyZoneSpec': this};
propertyKeys: string[] | null = null;
View on GitHub (pinned to 51cb07e980)
Solutions
- Use the global it/describe functions patched by zone-testing instead of importing them directly from the test framework.
When it happens
Trigger: Thrown at packages/zone.js/lib/zone-spec/proxy.ts:16 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of angular/angular@51cb07e980 (2026-08-22).
Data as JSON: /api/errors/810f904a6da7a126.
Report an issue: GitHub.