zone.js fails to patch mocha v8.3.1 and up
See original GitHub issueWhich @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 themocha
dependency to8.3.1
or higher, then runnpm 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
Issue Analytics
- State:
- Created 2 years ago
- Reactions:10
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Mocha Testing Angular referenceError: Zone is not defined
I tried to import 'zone.js' inside my test code but it had no affect. Would anyone know how to bypass or fix this...
Read more >cannot read properties of undefined (reading 'data') axios
This error originates from swr/dist/index.mjs at line 153. Update. This error only occurred to me when @mux/mux-video-react was installed. Expected Behavior.
Read more >A Brief History of JavaScript - Auth0
We take a look at the evolution of JavaScript, arguably one of the most important languages of today, and tomorrow.
Read more >gun - node_modules - mocha - CHANGELOG.md
:warning: Due to the increasing difficulty of applying security patches made within its dependency tree, as well as looming incompatibilities ...
Read more >Firebase JavaScript SDK Release Notes - Google
The earlier update in version 9.13.0 upgraded TypeScript only in the root. ... The v8 SDK is updated only for emergency security fixes,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Would it be possible to get this prioritized? It will impact anyone using Mocha with Angular unit tests.
See also: https://github.com/mochajs/mocha/issues/4660#issuecomment-953988083
@juergba , I am not sure about the release schedule, I will plan to cut a new release after several other issues of zone.js are fixed.