angular/packages/zone.js/test/browser-zone-setup.ts
JiaLiPassion 435dd32912 fix(zone.js): disable wrapping unhandled promise error by default (#52492)
Before this commit, zone.js wraps the uncaught promise rejection error
to a new Error object includes more information such as Zone stack
traces. This feature is provided from the very beginning of Zone.js,
but this feature becomes very annoying and make the user difficult to
debug.

So this commit disable this wrapping behavior by default, and user can
enable this feature back by setting
`DISABLE_WRAPPING_UNCAUGHT_PROMISE_REJECTION` to `false`.

PR Close #52492
2023-11-03 09:33:20 -07:00

30 lines
1.1 KiB
TypeScript

/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
if (typeof window !== 'undefined') {
const zoneSymbol = (window as any).Zone.__symbol__;
(window as any)['__Zone_enable_cross_context_check'] = true;
(window as any)[zoneSymbol('fakeAsyncAutoFakeAsyncWhenClockPatched')] = true;
(window as any)[zoneSymbol('DISABLE_WRAPPING_UNCAUGHT_PROMISE_REJECTION')] = false;
}
import '../lib/common/to-string';
import '../lib/browser/api-util';
import '../lib/browser/browser-legacy';
import '../lib/browser/browser';
import '../lib/browser/canvas';
import '../lib/common/fetch';
import '../lib/browser/webapis-user-media';
import '../lib/browser/webapis-media-query';
import '../lib/testing/zone-testing';
import '../lib/zone-spec/task-tracking';
import '../lib/zone-spec/wtf';
import '../lib/extra/cordova';
import '../lib/testing/promise-testing';
import '../lib/testing/async-testing';
import '../lib/testing/fake-async';
import '../lib/browser/webapis-resize-observer';
import '../lib/rxjs/rxjs-fake-async';