{"record":{"id":"282437e66cbc656f","repo":"angular/angular","slug":"missing-proxyzonespec-282437","errorCode":null,"errorMessage":"Missing ProxyZoneSpec","messagePattern":"Missing ProxyZoneSpec","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/zone.js/lib/jest/jest.ts","lineNumber":35,"sourceCode":"      return;\n    }\n\n    // From jest 29 and jest-preset-angular v13, the module transform logic\n    // changed, and now jest-preset-angular use the use the tsconfig target\n    // other than the hardcoded one, https://github.com/thymikee/jest-preset-angular/issues/2010\n    // But jest-angular-preset doesn't introduce the @babel/plugin-transform-async-to-generator\n    // which is needed by angular since `async/await` still need to be transformed\n    // to promise for ES2017+ target.\n    // So for now, we disable to output the uncaught error console log for a temp solution,\n    // until jest-preset-angular find a proper solution.\n    (Zone as any)[api.symbol('ignoreConsoleErrorUncaughtError')] = true;\n    jest['__zone_patch__'] = true;\n\n    const ProxyZoneSpec = (Zone as any)['ProxyZoneSpec'];\n    const SyncTestZoneSpec = (Zone as any)['SyncTestZoneSpec'];\n\n    if (!ProxyZoneSpec) {\n      throw new Error('Missing ProxyZoneSpec');\n    }\n\n    const rootZone = Zone.current;\n    const syncZone = rootZone.fork(new SyncTestZoneSpec('jest.describe'));\n    const proxyZoneSpec = new ProxyZoneSpec();\n    const proxyZone = rootZone.fork(proxyZoneSpec);\n\n    function wrapDescribeFactoryInZone(originalJestFn: Function) {\n      return function (this: unknown, ...tableArgs: any[]) {\n        const originalDescribeFn = originalJestFn.apply(this, tableArgs);\n        return function (this: unknown, ...args: any[]) {\n          args[1] = wrapDescribeInZone(args[1]);\n          return originalDescribeFn.apply(this, args);\n        };\n      };\n    }\n\n    function wrapTestFactoryInZone(originalJestFn: Function) {","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/angular/angular/blob/51cb07e98081ab7e4e84a9e0949266a8e19cca84/packages/zone.js/lib/jest/jest.ts#L17-L53","documentation":"Thrown by zone.js's jest patch (jest.ts:35): patching jest requires ProxyZoneSpec (from the proxy zone-spec patch) so each test can retroactively install zones (fakeAsync etc.). If Zone['ProxyZoneSpec'] is undefined when the jest patch runs, it aborts with this error. Unlike the jasmine patch there is no SyncTestZoneSpec existence check here, but jest still relies on both specs being registered.","triggerScenarios":"Loading zone.js/jest (or zone.js/testing under jest) without the proxy zone-spec having registered ProxyZoneSpec — wrong import order, partial bundles, or a bundler that drops the side-effectful proxy patch.","commonSituations":"Jest + Angular setups with a custom setupFiles list that omits 'zone.js/testing'; version upgrades of zone.js or jest-preset-angular changing required imports; ESM configurations dropping side effects.","solutions":["In jest config, load zone.js then zone.js/testing in setupFiles: ['zone.js', 'zone.js/testing'] (or use jest-preset-angular's preset which does this).","Verify the bundler keeps zone.js side effects (sideEffects: true for zone.js packages).","If assembling files manually, include zone.js/lib/zone-spec/proxy before zone.js/lib/jest/jest."],"exampleFix":"// before (jest.config.js)\nsetupFiles: ['./src/setup-jest.ts']\n// setup-jest.ts only imports 'zone.js/lib/jest/jest'\n\n// after (setup-jest.ts)\nimport 'zone.js';\nimport 'zone.js/testing';","handlingStrategy":"validation","validationCode":"// jest setup: verify proxy spec registered before tests run\nimport 'zone.js';\nimport 'zone.js/testing';\nif (!(globalThis as any).Zone?.ProxyZoneSpec) {\n  throw new Error('zone.js/testing failed to register ProxyZoneSpec — check import order/sideEffects.');\n}","typeGuard":"function hasProxyZoneSpecForJest(): boolean { return !!(globalThis as any).Zone?.ProxyZoneSpec; }","tryCatchPattern":null,"preventionTips":["Use jest-preset-angular's preset, which loads zone.js/testing in the correct order.","Ensure bundler config keeps zone.js module side effects enabled."],"tags":["zone-js","jest","testing","proxy-zone","setup"],"backgroundTag":"zone-js-test-patch-missing-prerequisite","analyzedSha":"51cb07e98081ab7e4e84a9e0949266a8e19cca84","analyzedAt":"2026-08-22T07:04:54.531Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}