Skip to content

Commit

Permalink
Make jest properly exit after all tests
Browse files Browse the repository at this point in the history
  • Loading branch information
matheus23 committed May 26, 2021
1 parent 409f287 commit eab6bc8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/fs/protocol/private/mmpt.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
})

/*
Expand Down
4 changes: 4 additions & 0 deletions tests/fs/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
})


Expand Down

0 comments on commit eab6bc8

Please sign in to comment.