{"record":{"id":"48114abac04254b0","repo":"angular/angular","slug":"proxyzonespec-is-needed-for-the-withproxyzone-te","errorCode":null,"errorMessage":"ProxyZoneSpec is needed for the withProxyZone() test helper but could not be found. Make sure that your environment includes zone-testing.js","messagePattern":"ProxyZoneSpec is needed for the withProxyZone\\(\\) test helper but could not be found\\. Make sure that your environment includes zone-testing\\.js","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/zone.js/lib/zone-spec/fake-async-test.ts","lineNumber":1079,"sourceCode":"}\n\n/**\n * Wraps a function to be executed in a shared ProxyZone.\n *\n * If no shared ProxyZone exists, one is created and reused for subsequent calls.\n * Useful for wrapping test setup (beforeEach) and test execution (it) when test\n * runner patching isn't available or desired for setting up the ProxyZone.\n *\n * @param fn The function to wrap.\n * @returns A function that executes the original function within the shared ProxyZone.\n *\n * @experimental\n */\nexport function withProxyZone<T extends Function>(fn: T): T {\n  const autoProxyFn: any = function (this: unknown, ...args: any[]) {\n    const proxyZoneSpec = getProxyZoneSpec();\n    if (proxyZoneSpec === undefined) {\n      throw new Error(\n        'ProxyZoneSpec is needed for the withProxyZone() test helper but could not be found. ' +\n          'Make sure that your environment includes zone-testing.js',\n      );\n    }\n\n    const proxyZone = proxyZoneSpec.get() !== undefined ? Zone.current : getOrCreateRootProxy();\n    return proxyZone.run(fn, this, args);\n  };\n  return autoProxyFn as T;\n}\n\nfunction getOrCreateRootProxy() {\n  const ProxyZoneSpec = getProxyZoneSpec();\n  if (ProxyZoneSpec === undefined) {\n    throw new Error(\n      'ProxyZoneSpec is needed for withProxyZone but could not be found. ' +\n        'Make sure that your environment includes zone-testing.js',\n    );","sourceCodeStart":1061,"sourceCodeEnd":1097,"githubUrl":"https://github.com/angular/angular/blob/51cb07e98081ab7e4e84a9e0949266a8e19cca84/packages/zone.js/lib/zone-spec/fake-async-test.ts#L1061-L1097","documentation":"Error \"ProxyZoneSpec is needed for the withProxyZone() test helper but could not be found. Make sure that your environment includes zone-testing.js\" thrown in angular/angular.","triggerScenarios":"Thrown at packages/zone.js/lib/zone-spec/fake-async-test.ts:1079 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Include zone-testing.js (or zone.js/plugins/proxy) in the test environment setup."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"51cb07e98081ab7e4e84a9e0949266a8e19cca84","analyzedAt":"2026-08-22T07:04:54.531Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}