Skip to content

Angular/Jasmine Error: Expected to be running in 'ProxyZone', but it was not found #3535

@Yiding-Aya

Description

@Yiding-Aya

Issue description or question

Error: Expected to be running in 'ProxyZone', but it was not found.

Regression: yes

Started showing since upgraded to Angular 20.

Observation: the errors seems related to Component harness - all failed tests with this error message using component harness with Angular Material.
https://angular.dev/guide/testing/component-harnesses-overview

Minimal reproduction:

// Example of test with a harness for a component called MyButtonComponent
it('should load button with exact text', async () => {
  const button = await loader.getHarness(MyButtonComponentHarness);
  expect(await button.getText()).toBe('Confirm');
});

Package Version

@angular-devkit/architect 0.2001.4
@angular-devkit/core 20.1.4
@angular-devkit/schematics 20.1.4
@schematics/angular 20.1.4
rxjs 7.8.2
typescript 5.8.3
zone.js 0.15.1

Wallaby diagnostics report

    "2025-08-04T15:22:55.330Z stack Failed to map the stack to user code, entry message: Error: Expected to be running in 'ProxyZone', but it was not found., stack: Error: Expected to be running in 'ProxyZone', but it was not found.\n" +
      '    at _ProxyZoneSpec.assertPresent (http://localhost:50326/zone-testing.js:1639:13)\n' +
      '    at _TaskStateZoneInterceptor.setup (http://localhost:50326/chunk-NGGIDD6M.js:88:36)\n' +
      '    at new _TestbedHarnessEnvironment (http://localhost:50326/chunk-NGGIDD6M.js:566:50)\n' +
      '    at _TestbedHarnessEnvironment.createEnvironment (http://localhost:50326/chunk-NGGIDD6M.js:637:12)\n' +
      '    at _TestbedHarnessEnvironment.createComponentHarness (http://localhost:50326/chunk-NYM35OUV.js:658:33)\n' +
      '    at _TestbedHarnessEnvironment._getQueryResultForElement (http://localhost:50326/chunk-NYM35OUV.js:695:28)\n' +
      '    at http://localhost:50326/chunk-NYM35OUV.js:678:46\n' +
      '    at Array.map (<anonymous>)\n' +
      '    at http://localhost:50326/chunk-NYM35OUV.js:678:26\n' +
      '    at http://localhost:50326/chunk-NYM35OUV.js:51:49\n' +
      '    at batchChangeDetection (http://localhost:50326/chunk-NYM35OUV.js:23:18)\n' +
      '    at parallel (http://localhost:50326/chunk-NYM35OUV.js:51:10)\n' +
      '    at http://localhost:50326/chunk-NYM\n',

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions