Skip to content

Commit

Permalink
test: remove delay before exit (#60)
Browse files Browse the repository at this point in the history
Before my change, the mocha process would print test summary and then
wait for around two seconds before exiting.

In this change, I am adding a call to `server.closeAllConnections()`
to make sure there are no pending HTTP connections blocking the exit.

While changing the `after` hook, I also fixed it to `await` until
the PG client is closed.

Signed-off-by: Miroslav Bajtoš <[email protected]>
  • Loading branch information
bajtos authored Sep 1, 2023
1 parent bbda3fa commit 908bbcf
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ describe('Routes', () => {
spark = `http://127.0.0.1:${server.address().port}`
})

after(() => {
after(async () => {
server.closeAllConnections()
server.close()
client.end()
await client.end()
})

describe('GET /', () => {
Expand Down

0 comments on commit 908bbcf

Please sign in to comment.