graphile-test 2.7.2 → 2.8.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/README.md +2 -0
- package/esm/graphile-test.js +15 -3
- package/esm/index.js +1 -0
- package/graphile-test.js +15 -3
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +3 -4
- package/types.d.ts +2 -0
package/README.md
CHANGED
|
@@ -20,6 +20,8 @@
|
|
|
20
20
|
|
|
21
21
|
It provides a seamless setup for isolated, seeded, role-aware Postgres databases and injects GraphQL helpers for snapshot testing, role context, and mutation/query assertions.
|
|
22
22
|
|
|
23
|
+
**Note:** This is a bare-bones package with no defaults or settings applied. For a batteries-included version with all LaunchQL plugins pre-configured, use [`launchql-test`](https://github.com/launchql/launchql/tree/main/packages/launchql-test) instead.
|
|
24
|
+
|
|
23
25
|
## 🚀 Features
|
|
24
26
|
|
|
25
27
|
* 🔁 **Per-test rollback** via savepoints for isolation
|
package/esm/graphile-test.js
CHANGED
|
@@ -1,13 +1,25 @@
|
|
|
1
|
-
import { getGraphileSettings } from 'graphile-settings';
|
|
2
1
|
import { createPostGraphileSchema } from 'postgraphile';
|
|
3
2
|
import { runGraphQLInContext } from './context';
|
|
4
3
|
export const GraphQLTest = (input, conn) => {
|
|
5
|
-
const { schemas, authRole } = input;
|
|
4
|
+
const { schemas, authRole, graphile } = input;
|
|
6
5
|
let schema;
|
|
7
6
|
let options;
|
|
8
7
|
const pgPool = conn.manager.getPool(conn.pg.config);
|
|
9
8
|
const setup = async () => {
|
|
10
|
-
|
|
9
|
+
// Bare-bones configuration - no defaults, only use what's explicitly provided
|
|
10
|
+
// This gives full control over PostGraphile configuration
|
|
11
|
+
options = {
|
|
12
|
+
schema: schemas,
|
|
13
|
+
// Only apply graphile options if explicitly provided
|
|
14
|
+
...(graphile?.appendPlugins && {
|
|
15
|
+
appendPlugins: graphile.appendPlugins
|
|
16
|
+
}),
|
|
17
|
+
...(graphile?.graphileBuildOptions && {
|
|
18
|
+
graphileBuildOptions: graphile.graphileBuildOptions
|
|
19
|
+
}),
|
|
20
|
+
// Apply any overrideSettings if provided
|
|
21
|
+
...(graphile?.overrideSettings || {})
|
|
22
|
+
};
|
|
11
23
|
schema = await createPostGraphileSchema(pgPool, schemas, options);
|
|
12
24
|
};
|
|
13
25
|
const teardown = async () => { };
|
package/esm/index.js
CHANGED
package/graphile-test.js
CHANGED
|
@@ -1,16 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GraphQLTest = void 0;
|
|
4
|
-
const graphile_settings_1 = require("graphile-settings");
|
|
5
4
|
const postgraphile_1 = require("postgraphile");
|
|
6
5
|
const context_1 = require("./context");
|
|
7
6
|
const GraphQLTest = (input, conn) => {
|
|
8
|
-
const { schemas, authRole } = input;
|
|
7
|
+
const { schemas, authRole, graphile } = input;
|
|
9
8
|
let schema;
|
|
10
9
|
let options;
|
|
11
10
|
const pgPool = conn.manager.getPool(conn.pg.config);
|
|
12
11
|
const setup = async () => {
|
|
13
|
-
|
|
12
|
+
// Bare-bones configuration - no defaults, only use what's explicitly provided
|
|
13
|
+
// This gives full control over PostGraphile configuration
|
|
14
|
+
options = {
|
|
15
|
+
schema: schemas,
|
|
16
|
+
// Only apply graphile options if explicitly provided
|
|
17
|
+
...(graphile?.appendPlugins && {
|
|
18
|
+
appendPlugins: graphile.appendPlugins
|
|
19
|
+
}),
|
|
20
|
+
...(graphile?.graphileBuildOptions && {
|
|
21
|
+
graphileBuildOptions: graphile.graphileBuildOptions
|
|
22
|
+
}),
|
|
23
|
+
// Apply any overrideSettings if provided
|
|
24
|
+
...(graphile?.overrideSettings || {})
|
|
25
|
+
};
|
|
14
26
|
schema = await (0, postgraphile_1.createPostGraphileSchema)(pgPool, schemas, options);
|
|
15
27
|
};
|
|
16
28
|
const teardown = async () => { };
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.seed = void 0;
|
|
18
18
|
__exportStar(require("./clean"), exports);
|
|
19
|
+
__exportStar(require("./context"), exports);
|
|
19
20
|
__exportStar(require("./get-connections"), exports);
|
|
20
21
|
__exportStar(require("./graphile-test"), exports);
|
|
21
22
|
__exportStar(require("./types"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graphile-test",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"author": "Dan Lynch <pyramation@gmail.com>",
|
|
5
5
|
"description": "PostGraphile Testing",
|
|
6
6
|
"main": "index.js",
|
|
@@ -35,11 +35,10 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@launchql/types": "^2.8.1",
|
|
38
|
-
"graphile-settings": "^2.6.2",
|
|
39
38
|
"graphql": "15.10.1",
|
|
40
39
|
"mock-req": "^0.2.0",
|
|
41
40
|
"pg": "^8.16.0",
|
|
42
|
-
"pgsql-test": "^2.14.
|
|
41
|
+
"pgsql-test": "^2.14.3",
|
|
43
42
|
"postgraphile": "^4.14.1"
|
|
44
43
|
},
|
|
45
44
|
"keywords": [
|
|
@@ -49,5 +48,5 @@
|
|
|
49
48
|
"launchql",
|
|
50
49
|
"test"
|
|
51
50
|
],
|
|
52
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "da2bd9606bd5e1d4e63b7d74f08920975980e541"
|
|
53
52
|
}
|
package/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { GraphileOptions } from '@launchql/types';
|
|
1
2
|
import { DocumentNode, GraphQLError } from 'graphql';
|
|
2
3
|
export interface GraphQLQueryOptions<TVariables = Record<string, any>> {
|
|
3
4
|
query: string | DocumentNode;
|
|
@@ -14,6 +15,7 @@ export interface GetConnectionsInput {
|
|
|
14
15
|
useRoot?: boolean;
|
|
15
16
|
schemas: string[];
|
|
16
17
|
authRole?: string;
|
|
18
|
+
graphile?: GraphileOptions;
|
|
17
19
|
}
|
|
18
20
|
export interface GraphQLQueryOptions<TVariables = Record<string, any>> {
|
|
19
21
|
query: string | DocumentNode;
|