pgsql-test 2.6.3 → 2.7.0
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/connect.js +17 -11
- package/esm/connect.js +17 -11
- package/package.json +3 -3
package/connect.js
CHANGED
|
@@ -48,13 +48,24 @@ const getConnections = async (cn = {}, seedAdapters = [seed_1.seed.launchql()])
|
|
|
48
48
|
await admin.grantConnect(connOpts.connection.user, config.database);
|
|
49
49
|
manager = manager_1.PgTestConnector.getInstance();
|
|
50
50
|
const pg = manager.getClient(config);
|
|
51
|
+
const teardown = async () => {
|
|
52
|
+
manager.beginTeardown();
|
|
53
|
+
await (0, pg_cache_1.teardownPgPools)();
|
|
54
|
+
await manager.closeAll();
|
|
55
|
+
};
|
|
51
56
|
if (seedAdapters.length) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
try {
|
|
58
|
+
await seed_1.seed.compose(seedAdapters).seed({
|
|
59
|
+
connect: connOpts,
|
|
60
|
+
admin,
|
|
61
|
+
config: config,
|
|
62
|
+
pg: manager.getClient(config)
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
await teardown();
|
|
67
|
+
throw error;
|
|
68
|
+
}
|
|
58
69
|
}
|
|
59
70
|
const db = manager.getClient({
|
|
60
71
|
...config,
|
|
@@ -62,11 +73,6 @@ const getConnections = async (cn = {}, seedAdapters = [seed_1.seed.launchql()])
|
|
|
62
73
|
password: connOpts.connection.password
|
|
63
74
|
});
|
|
64
75
|
db.setContext({ role: 'anonymous' });
|
|
65
|
-
const teardown = async () => {
|
|
66
|
-
manager.beginTeardown();
|
|
67
|
-
await (0, pg_cache_1.teardownPgPools)();
|
|
68
|
-
await manager.closeAll();
|
|
69
|
-
};
|
|
70
76
|
return { pg, db, teardown, manager, admin };
|
|
71
77
|
};
|
|
72
78
|
exports.getConnections = getConnections;
|
package/esm/connect.js
CHANGED
|
@@ -44,13 +44,24 @@ export const getConnections = async (cn = {}, seedAdapters = [seed.launchql()])
|
|
|
44
44
|
await admin.grantConnect(connOpts.connection.user, config.database);
|
|
45
45
|
manager = PgTestConnector.getInstance();
|
|
46
46
|
const pg = manager.getClient(config);
|
|
47
|
+
const teardown = async () => {
|
|
48
|
+
manager.beginTeardown();
|
|
49
|
+
await teardownPgPools();
|
|
50
|
+
await manager.closeAll();
|
|
51
|
+
};
|
|
47
52
|
if (seedAdapters.length) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
try {
|
|
54
|
+
await seed.compose(seedAdapters).seed({
|
|
55
|
+
connect: connOpts,
|
|
56
|
+
admin,
|
|
57
|
+
config: config,
|
|
58
|
+
pg: manager.getClient(config)
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
await teardown();
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
54
65
|
}
|
|
55
66
|
const db = manager.getClient({
|
|
56
67
|
...config,
|
|
@@ -58,10 +69,5 @@ export const getConnections = async (cn = {}, seedAdapters = [seed.launchql()])
|
|
|
58
69
|
password: connOpts.connection.password
|
|
59
70
|
});
|
|
60
71
|
db.setContext({ role: 'anonymous' });
|
|
61
|
-
const teardown = async () => {
|
|
62
|
-
manager.beginTeardown();
|
|
63
|
-
await teardownPgPools();
|
|
64
|
-
await manager.closeAll();
|
|
65
|
-
};
|
|
66
72
|
return { pg, db, teardown, manager, admin };
|
|
67
73
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pgsql-test",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"author": "Dan Lynch <pyramation@gmail.com>",
|
|
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",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"@types/pg-copy-streams": "^1.2.5"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@launchql/core": "^2.
|
|
63
|
+
"@launchql/core": "^2.8.0",
|
|
64
64
|
"@launchql/env": "^2.2.1",
|
|
65
65
|
"@launchql/server-utils": "^2.2.1",
|
|
66
66
|
"@launchql/types": "^2.3.0",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"pg-copy-streams": "^6.0.6",
|
|
70
70
|
"pg-env": "^1.1.0"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "bbe6d40a54b5727641cc0184e01f9701796bc0b5"
|
|
73
73
|
}
|