Skip to content

Commit 80048fc

Browse files
committed
Merge branch 'main' into feat-nested-hook-calls
2 parents c9a0af5 + 3dd91f7 commit 80048fc

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"files": [
1717
"dist"
1818
],
19-
"version": "7.2.0",
19+
"version": "7.2.1",
2020
"main": "dist/index.js",
2121
"module": "./dist/index.mjs",
2222
"types": "./dist/index.d.ts",

src/public-types.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,26 @@ export interface GetTestPostgresDatabaseResult extends ConnectionDetails {
106106

107107
export type GetTestPostgresDatabaseOptions = {
108108
/**
109-
* If `getTestPostgresDatabase()` is called multiple times with the same `key` and `params`, the same database is guaranteed to be returned.
109+
* By default, `ava-postgres` will create a new database for each test. If you want to share a database between tests, you can use the `databaseDedupeKey` option.
110+
* This works across the entire test suite.
111+
*
112+
* Note that if unique parameters are passed to the `beforeTemplateIsBaked` (`null` in the above example), separate databases will still be created.
113+
* @example
114+
* ```ts
115+
* import test from "ava"
116+
*
117+
* const getTestPostgresDatabase = getTestPostgresDatabaseFactory({})
118+
*
119+
* test("foo", async (t) => {
120+
* const connection1 = await getTestPostgresDatabase(t, null, {
121+
* databaseDedupeKey: "foo",
122+
* })
123+
* const connection2 = await getTestPostgresDatabase(t, null, {
124+
* databaseDedupeKey: "foo",
125+
* })
126+
* t.is(connection1.database, connection2.database)
127+
* })
128+
* ```
110129
*/
111130
/**
112131
* By default, `ava-postgres` will create a new database for each test. If you want to share a database between tests, you can use the `databaseDedupeKey` option.

0 commit comments

Comments
 (0)