mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
fix(zone.js): Support jasmine v6
This fixes the jasmine patch to ensure we are patching the private APIs
off of the right location, which changed in v6.
see https://github.com/jasmine/jasmine/commit/168ff0a751b6280b170ce097410d77a4c7c1f449
(cherry picked from commit 48abe007d9)
This commit is contained in:
committed by
Kristiyan Kostadinov
parent
fb13537949
commit
de5b0661e9
@@ -239,10 +239,15 @@ export function patchJasmine(Zone: ZoneType): void {
|
||||
timeout: {setTimeout: Function; clearTimeout: Function};
|
||||
}
|
||||
type QueueRunnerUserContext = {queueRunner?: QueueRunner};
|
||||
const QueueRunner = (jasmine as any).QueueRunner as {
|
||||
const j$ = jasmine as any;
|
||||
const privateApis: {
|
||||
QueueRunner: {};
|
||||
UserContext: new (...args: any[]) => QueueRunnerUserContext;
|
||||
} = j$?.private?.QueueRunner ? j$?.private : j$;
|
||||
const QueueRunner = privateApis.QueueRunner as {
|
||||
new (attrs: QueueRunnerAttrs): QueueRunner;
|
||||
};
|
||||
(jasmine as any).QueueRunner = (function (_super) {
|
||||
privateApis.QueueRunner = (function (_super) {
|
||||
__extends(ZoneQueueRunner, _super);
|
||||
function ZoneQueueRunner(this: QueueRunner, attrs: QueueRunnerAttrs) {
|
||||
if (attrs.onComplete) {
|
||||
@@ -266,9 +271,9 @@ export function patchJasmine(Zone: ZoneType): void {
|
||||
|
||||
// create a userContext to hold the queueRunner itself
|
||||
// so we can access the testProxy in it/xit/beforeEach ...
|
||||
if ((jasmine as any).UserContext) {
|
||||
if (privateApis.UserContext) {
|
||||
if (!attrs.userContext) {
|
||||
attrs.userContext = new (jasmine as any).UserContext();
|
||||
attrs.userContext = new privateApis.UserContext();
|
||||
}
|
||||
attrs.userContext.queueRunner = this;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user