From cc7993960a1761db55af8d2d8fab329be17f978e Mon Sep 17 00:00:00 2001 From: Nicholas Jamieson Date: Mon, 5 Jul 2021 18:20:34 +1000 Subject: [PATCH 1/3] chore: appease TS in CI global.gc seems to be possibly undefined in the latest Node types --- spec/Subscriber-spec.ts | 2 +- spec/operators/shareReplay-spec.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/Subscriber-spec.ts b/spec/Subscriber-spec.ts index f4d63bccce..079c272b64 100644 --- a/spec/Subscriber-spec.ts +++ b/spec/Subscriber-spec.ts @@ -244,7 +244,7 @@ describe('Subscriber', () => { }); const FinalizationRegistry = (global as any).FinalizationRegistry; - if (FinalizationRegistry) { + if (FinalizationRegistry && global.gc) { it('should not leak the destination', (done) => { let observer: Observer | undefined = { diff --git a/spec/operators/shareReplay-spec.ts b/spec/operators/shareReplay-spec.ts index 0b336dac74..080aea9006 100644 --- a/spec/operators/shareReplay-spec.ts +++ b/spec/operators/shareReplay-spec.ts @@ -366,7 +366,7 @@ describe('shareReplay', () => { }); const FinalizationRegistry = (global as any).FinalizationRegistry; - if (FinalizationRegistry) { + if (FinalizationRegistry && global.gc) { it('should not leak the subscriber for sync sources', (done) => { let callback: (() => void) | undefined = () => { /* noop */ From 015cba6f1803df63d19bd14d3a5b9e6fd7047cfb Mon Sep 17 00:00:00 2001 From: Nicholas Jamieson Date: Mon, 5 Jul 2021 18:23:46 +1000 Subject: [PATCH 2/3] chore: appease TS --- spec/schedulers/intervalProvider-spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/schedulers/intervalProvider-spec.ts b/spec/schedulers/intervalProvider-spec.ts index 990bf6cbfa..55bf3f9690 100644 --- a/spec/schedulers/intervalProvider-spec.ts +++ b/spec/schedulers/intervalProvider-spec.ts @@ -15,10 +15,10 @@ describe('intervalProvider', () => { let setCalled = false; let clearCalled = false; - global.setInterval = () => { + global.setInterval = (() => { setCalled = true; return 0 as any; - }; + }) as any; // TypeScript complains about a __promisify__ property global.clearInterval = () => { clearCalled = true; }; From 0dd9d7a37d900ce864ce2ef8ff643ed6a5573d17 Mon Sep 17 00:00:00 2001 From: Nicholas Jamieson Date: Mon, 5 Jul 2021 18:29:51 +1000 Subject: [PATCH 3/3] chore: add optional shenanigans --- spec/Subscriber-spec.ts | 2 +- spec/operators/shareReplay-spec.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/Subscriber-spec.ts b/spec/Subscriber-spec.ts index 079c272b64..72169b83b9 100644 --- a/spec/Subscriber-spec.ts +++ b/spec/Subscriber-spec.ts @@ -262,7 +262,7 @@ describe('Subscriber', () => { const subscription = of(42).subscribe(observer); observer = undefined; - global.gc(); + global.gc?.(); }); } else { diff --git a/spec/operators/shareReplay-spec.ts b/spec/operators/shareReplay-spec.ts index 080aea9006..86f115232d 100644 --- a/spec/operators/shareReplay-spec.ts +++ b/spec/operators/shareReplay-spec.ts @@ -382,7 +382,7 @@ describe('shareReplay', () => { shared.subscribe(callback); callback = undefined; - global.gc(); + global.gc?.(); }); } else { console.warn(`No support for FinalizationRegistry in Node ${process.version}`);