From 79269923e237f25033f37a4ce4676a608b52e08b Mon Sep 17 00:00:00 2001 From: harazdovskiy Date: Tue, 27 Dec 2022 18:04:52 +0200 Subject: [PATCH] feat: Fixed tests timeout --- package.json | 2 +- src/setup.ts | 3 ++- src/teardown.ts | 6 +++--- test/client.test.ts | 4 +++- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index a0a7aa6..363bc8d 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "preset": "./jest-preset.js" }, "dependencies": { - "@shelf/postgres-local": "1.0.2", + "@shelf/postgres-local": "1.0.3", "cwd": "0.10.0" }, "devDependencies": { diff --git a/src/setup.ts b/src/setup.ts index 2135d1e..0213b44 100644 --- a/src/setup.ts +++ b/src/setup.ts @@ -1,8 +1,9 @@ import {start} from '@shelf/postgres-local'; import cwd from 'cwd'; +const config = require(`${cwd()}/jest-postgres-config.js`); + module.exports = async function startPostgres() { - const config = require(`${cwd()}/jest-postgres-config.js`); await start(config); return true; diff --git a/src/teardown.ts b/src/teardown.ts index 04309c6..5e0556d 100644 --- a/src/teardown.ts +++ b/src/teardown.ts @@ -1,8 +1,8 @@ import {stop} from '@shelf/postgres-local'; import cwd from 'cwd'; -module.exports = function stopPostgres() { - const config = require(`${cwd()}/jest-postgres-config.js`); +const config = require(`${cwd()}/jest-postgres-config.js`); - return stop(config); +module.exports = async function stopPostgres() { + await stop(config); }; diff --git a/test/client.test.ts b/test/client.test.ts index efe35f3..b35c2f1 100644 --- a/test/client.test.ts +++ b/test/client.test.ts @@ -1,4 +1,4 @@ -import {getClient} from './client'; +import {closeConnection, getClient} from './client'; describe('#getClient', () => { const client = getClient({ @@ -29,5 +29,7 @@ describe('#getClient', () => { vector: null, }, ]); + + await closeConnection(); }); });