pgsql-test 2.20.0 → 2.20.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/esm/manager.js CHANGED
@@ -5,13 +5,13 @@ import { DbAdmin } from './admin';
5
5
  import { PgTestClient } from './test-client';
6
6
  const log = new Logger('test-connector');
7
7
  const SYS_EVENTS = ['SIGTERM'];
8
- const end = (pool) => {
8
+ const end = async (pool) => {
9
9
  try {
10
10
  if (pool.ended || pool.ending) {
11
11
  log.warn('⚠️ pg pool already ended or ending');
12
12
  return;
13
13
  }
14
- pool.end();
14
+ await pool.end();
15
15
  }
16
16
  catch (err) {
17
17
  log.error('❌ pg pool termination error:', err);
@@ -100,11 +100,13 @@ export class PgTestConnector {
100
100
  }));
101
101
  this.clients.clear();
102
102
  log.info('🧯 Disposing pg pools...');
103
+ const poolTasks = [];
103
104
  for (const [key, pool] of this.pgPools.entries()) {
104
105
  log.debug(`🧯 Disposing pg pool [${key}]`);
105
- end(pool);
106
+ poolTasks.push(end(pool));
106
107
  }
107
108
  this.pgPools.clear();
109
+ await Promise.allSettled(poolTasks);
108
110
  if (keepDb) {
109
111
  log.info('📦 Keeping databases (keepDb=true)...');
110
112
  const dbNames = Array.from(this.seenDbConfigs.values()).map(c => c.database);
package/manager.js CHANGED
@@ -8,13 +8,13 @@ const admin_1 = require("./admin");
8
8
  const test_client_1 = require("./test-client");
9
9
  const log = new logger_1.Logger('test-connector');
10
10
  const SYS_EVENTS = ['SIGTERM'];
11
- const end = (pool) => {
11
+ const end = async (pool) => {
12
12
  try {
13
13
  if (pool.ended || pool.ending) {
14
14
  log.warn('⚠️ pg pool already ended or ending');
15
15
  return;
16
16
  }
17
- pool.end();
17
+ await pool.end();
18
18
  }
19
19
  catch (err) {
20
20
  log.error('❌ pg pool termination error:', err);
@@ -103,11 +103,13 @@ class PgTestConnector {
103
103
  }));
104
104
  this.clients.clear();
105
105
  log.info('🧯 Disposing pg pools...');
106
+ const poolTasks = [];
106
107
  for (const [key, pool] of this.pgPools.entries()) {
107
108
  log.debug(`🧯 Disposing pg pool [${key}]`);
108
- end(pool);
109
+ poolTasks.push(end(pool));
109
110
  }
110
111
  this.pgPools.clear();
112
+ await Promise.allSettled(poolTasks);
111
113
  if (keepDb) {
112
114
  log.info('📦 Keeping databases (keepDb=true)...');
113
115
  const dbNames = Array.from(this.seenDbConfigs.values()).map(c => c.database);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pgsql-test",
3
- "version": "2.20.0",
3
+ "version": "2.20.2",
4
4
  "author": "Constructive <developers@constructive.io>",
5
5
  "description": "pgsql-test offers isolated, role-aware, and rollback-friendly PostgreSQL environments for integration tests — giving developers realistic test coverage without external state pollution",
6
6
  "main": "index.js",
@@ -67,8 +67,8 @@
67
67
  "pg": "^8.16.3",
68
68
  "pg-cache": "^1.6.11",
69
69
  "pg-env": "^1.2.4",
70
- "pgsql-client": "^1.1.0",
71
- "pgsql-seed": "^0.2.2"
70
+ "pgsql-client": "^1.1.2",
71
+ "pgsql-seed": "^0.2.4"
72
72
  },
73
- "gitHead": "09721f934b339bd8c55d2e633abaded6d20b0f65"
73
+ "gitHead": "3768b497b5b65410a23bcf7e01ed4192a5f1dd95"
74
74
  }