@voxpelli/pg-utils 3.1.0 → 3.1.1
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/lib/test-helpers.d.ts.map +1 -1
- package/lib/test-helpers.js +21 -10
- package/package.json +6 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-helpers.d.ts","sourceRoot":"","sources":["test-helpers.js"],"names":[],"mappings":"AAuBA;IAuBE,qBADY,oBAAoB,EAoD/B;IAtDD,cADW,IAAI,CAAC,OAAO,CAAC,CACX;IA8Hb,cADc,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"test-helpers.d.ts","sourceRoot":"","sources":["test-helpers.js"],"names":[],"mappings":"AAuBA;IAuBE,qBADY,oBAAoB,EAoD/B;IAtDD,cADW,IAAI,CAAC,OAAO,CAAC,CACX;IA8Hb,cADc,OAAO,CAAC,IAAI,CAAC,CAoB1B;IAGD,kBADc,OAAO,CAAC,IAAI,CAAC,CAuB1B;IAGD,gBADc,OAAO,CAAC,IAAI,CAAC,CAqB1B;IAGD,OADc,OAAO,CAAC,IAAI,CAAC,CAO1B;;CACF;;sBAvOa,MAAM;oBACN,MAAM,GAAG,GAAG;mBACZ,MAAM,EAAE;YACR,MAAM,GAAG,GAAG,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,OAAO,EAAE,KAAK,CAAC,OAAO,WAAW,EAAE,gBAAgB,CAAC,IAAI,EAAE,OAAO,WAAW,EAAE,sBAAsB,CAAC,CAAC,CAAC;qBAC9I,KAAK,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC;6BACxB,KAAK,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC;;0BATJ,IAAI"}
|
package/lib/test-helpers.js
CHANGED
|
@@ -183,6 +183,7 @@ export class PgTestHelpers {
|
|
|
183
183
|
|
|
184
184
|
return pgInstallSchemaFromString(createUmzeptionPgContext(this.#pool), schema);
|
|
185
185
|
} catch (cause) {
|
|
186
|
+
await this.#releaseLocked();
|
|
186
187
|
throw new Error('Failed to create tables', { cause });
|
|
187
188
|
}
|
|
188
189
|
}
|
|
@@ -204,25 +205,35 @@ export class PgTestHelpers {
|
|
|
204
205
|
options = { tablesWithDependencies: this.#tablesWithDependencies.flat() };
|
|
205
206
|
}
|
|
206
207
|
|
|
207
|
-
|
|
208
|
+
try {
|
|
209
|
+
await csvFromFolderToDb(this.#pool, this.#fixtureFolder, options);
|
|
210
|
+
} catch (cause) {
|
|
211
|
+
await this.#releaseLocked();
|
|
212
|
+
throw new Error('Failed to import fixtures', { cause });
|
|
213
|
+
}
|
|
208
214
|
}
|
|
209
215
|
|
|
210
216
|
/** @returns {Promise<void>} */
|
|
211
217
|
async removeTables () {
|
|
212
218
|
await this.#ensureLocked();
|
|
213
219
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
220
|
+
try {
|
|
221
|
+
if (this.#tablesWithDependencies) {
|
|
222
|
+
await this.#removeTablesByName(this.#tablesWithDependencies);
|
|
223
|
+
}
|
|
217
224
|
|
|
218
|
-
|
|
219
|
-
|
|
225
|
+
let tableNames = await this.#getTableNames();
|
|
226
|
+
const ignoreTables = this.#ignoreTables;
|
|
220
227
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
228
|
+
if (ignoreTables) {
|
|
229
|
+
tableNames = tableNames.filter(name => !ignoreTables.includes(name));
|
|
230
|
+
}
|
|
224
231
|
|
|
225
|
-
|
|
232
|
+
await this.#removeTablesByName(tableNames);
|
|
233
|
+
} catch (cause) {
|
|
234
|
+
await this.#releaseLocked();
|
|
235
|
+
throw new Error('Failed to remove tables', { cause });
|
|
236
|
+
}
|
|
226
237
|
}
|
|
227
238
|
|
|
228
239
|
/** @returns {Promise<void>} */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voxpelli/pg-utils",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"description": " My personal database utils / helpers for Postgres",
|
|
5
5
|
"homepage": "http://github.com/voxpelli/pg-utils",
|
|
6
6
|
"repository": {
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@types/chai": "^4.3.20",
|
|
49
49
|
"@types/chai-as-promised": "^7.1.8",
|
|
50
50
|
"@types/mocha": "^10.0.10",
|
|
51
|
-
"@types/node": "^20.19.
|
|
51
|
+
"@types/node": "^20.19.37",
|
|
52
52
|
"@types/pg-copy-streams": "^1.2.5",
|
|
53
53
|
"@types/sinon": "^21.0.0",
|
|
54
54
|
"@voxpelli/eslint-config": "^23.0.0",
|
|
@@ -57,12 +57,13 @@
|
|
|
57
57
|
"chai": "^4.5.0",
|
|
58
58
|
"chai-as-promised": "^7.1.2",
|
|
59
59
|
"dotenv": "^17.3.1",
|
|
60
|
-
"eslint": "^9.39.
|
|
60
|
+
"eslint": "^9.39.4",
|
|
61
61
|
"husky": "^9.1.7",
|
|
62
|
-
"installed-check": "^10.0.
|
|
63
|
-
"knip": "^5.
|
|
62
|
+
"installed-check": "^10.0.1",
|
|
63
|
+
"knip": "^5.86.0",
|
|
64
64
|
"mocha": "^11.7.5",
|
|
65
65
|
"npm-run-all2": "^8.0.4",
|
|
66
|
+
"pony-cause": "^2.1.11",
|
|
66
67
|
"sinon": "^21.0.1",
|
|
67
68
|
"type-coverage": "^2.29.7",
|
|
68
69
|
"typescript": "~5.9.3",
|