From eab6bc836624241bd39172e5edd6442a4c6357f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Kr=C3=BCger?= Date: Wed, 26 May 2021 17:10:26 +0200 Subject: [PATCH] Make jest properly exit after all tests --- src/fs/protocol/private/mmpt.test.ts | 10 ++++++---- tests/fs/integration.test.ts | 4 ++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/fs/protocol/private/mmpt.test.ts b/src/fs/protocol/private/mmpt.test.ts index 7796d096d..9aedb560b 100644 --- a/src/fs/protocol/private/mmpt.test.ts +++ b/src/fs/protocol/private/mmpt.test.ts @@ -16,16 +16,18 @@ function encode(str: string): Uint8Array { let ipfs: IPFS | null = null -beforeAll(async done => { +beforeAll(async () => { ipfs = await createInMemoryIPFS() ipfsConfig.set(ipfs) - done() }) -afterAll(async done => { +afterAll(async () => { if (ipfs == null) return await ipfs.stop() - done() + // This seems to trigger GC, which seems to + // close some file handles or smth, which + // causes jest to finish properly + ipfs = null }) /* diff --git a/tests/fs/integration.test.ts b/tests/fs/integration.test.ts index b8fdf9fcf..8f6e48414 100644 --- a/tests/fs/integration.test.ts +++ b/tests/fs/integration.test.ts @@ -21,6 +21,10 @@ beforeAll(async () => { afterAll(async () => { if (ipfs == null) return await ipfs.stop() + // This seems to trigger GC, which seems to + // close some file handles or smth, which + // causes jest to finish properly + ipfs = null })