Skip to content

zone.js fails to patch mocha v8.3.1 and up #42834

@Alorel

Description

@Alorel

Which @angular/* package(s) are the source of the bug?

Don't known / other

Is this a regression?

No

Description

I've created a fresh Angular 12 project with the CLI, refactored tests to use Mocha instead of Jasmine and the tests failed.

  • Clone the repo and run npm test - everything will work fine
  • Open package.json and set the mocha dependency to 8.3.1 or higher, then run npm test again
  • You'll now get the exception below.

Please provide a link to a minimal reproduction of the bug

https://github.com/Alorel/zone.js-mocha-patch-bug-reproduction

Please provide the exception or error you saw

RangeError: Maximum call stack size exceeded
      at wrapTestInZone (http://localhost:9876/_karma_webpack_/webpack:/node_modules/zone.js/fesm2015/zone-testing.js:1024:1)
      at global.beforeEach.global.setup.Mocha.beforeEach (http://localhost:9876/_karma_webpack_/webpack:/node_modules/zone.js/fesm2015/zone-testing.js:1077:1)
      at exports.beforeEach (node_modules/mocha/mocha.js:28402:65)
      at global.beforeEach.global.setup.Mocha.beforeEach (http://localhost:9876/_karma_webpack_/webpack:/node_modules/zone.js/fesm2015/zone-testing.js:1077:1)
      at exports.beforeEach (node_modules/mocha/mocha.js:28402:65)
      at global.beforeEach.global.setup.Mocha.beforeEach (http://localhost:9876/_karma_webpack_/webpack:/node_modules/zone.js/fesm2015/zone-testing.js:1077:1)
      at exports.beforeEach (node_modules/mocha/mocha.js:28402:65)
      at global.beforeEach.global.setup.Mocha.beforeEach (http://localhost:9876/_karma_webpack_/webpack:/node_modules/zone.js/fesm2015/zone-testing.js:1077:1)
      at exports.beforeEach (node_modules/mocha/mocha.js:28402:65)
      at global.beforeEach.global.setup.Mocha.beforeEach (http://localhost:9876/_karma_webpack_/webpack:/node_modules/zone.js/fesm2015/zone-testing.js:1077:1)

Please provide the environment you discovered this bug in

Angular CLI: 12.1.1
Node: 14.16.1
Package Manager: npm 7.11.2
OS: linux x64

Angular: 12.1.1
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1201.1
@angular-devkit/build-angular   12.1.1
@angular-devkit/core            12.1.1
@angular-devkit/schematics      12.1.1
@schematics/angular             12.1.1
rxjs                            6.6.7
typescript                      4.3.5

Anything else?

The zone.js version is 0.11.4. The same happens on Angular 11 and zone 0.11.3

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: zonesIssues related to zone.jsstate: has PRtype: bug/fix

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions