@cedarjs/testing 1.1.1-next.0 → 1.1.1-next.18
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/config/jest/api/globalSetup.d.ts.map +1 -1
- package/config/jest/api/globalSetup.js +5 -2
- package/config/jest/api/jest-preset.js +1 -1
- package/config/jest/api/jest.setup.js +11 -7
- package/dist/api/vitest/CedarApiVitestEnv.d.ts.map +1 -1
- package/dist/api/vitest/CedarApiVitestEnv.js +6 -3
- package/dist/api/vitest/vitest-api.setup.js +9 -7
- package/dist/cjs/api/vitest/CedarApiVitestEnv.js +5 -2
- package/dist/cjs/api/vitest/vitest-api.setup.js +8 -6
- package/dist/cjs/config/jest/api/globalSetup.d.ts.map +1 -1
- package/dist/cjs/config/jest/api/globalSetup.js +5 -2
- package/dist/cjs/config/jest/api/jest-preset.js +1 -1
- package/dist/cjs/config/jest/api/jest.setup.js +11 -7
- package/dist/config/jest/api/globalSetup.d.ts.map +1 -1
- package/dist/config/jest/api/globalSetup.js +6 -3
- package/dist/config/jest/api/jest-preset.js +1 -1
- package/dist/config/jest/api/jest.setup.js +11 -7
- package/package.json +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globalSetup.d.ts","sourceRoot":"","sources":["../../../../../src/config/jest/api/globalSetup.ts"],"names":[],"mappings":"AACA,OAAO,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"globalSetup.d.ts","sourceRoot":"","sources":["../../../../../src/config/jest/api/globalSetup.ts"],"names":[],"mappings":"AACA,OAAO,wBAAwB,CAAA;AAc/B,0CAuCC"}
|
|
@@ -31,11 +31,12 @@ __export(globalSetup_exports, {
|
|
|
31
31
|
default: () => globalSetup_default
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(globalSetup_exports);
|
|
34
|
-
var import_internals = require("@prisma/internals");
|
|
34
|
+
var import_internals = __toESM(require("@prisma/internals"), 1);
|
|
35
35
|
var import_config = require("dotenv-defaults/config");
|
|
36
36
|
var import_execa = __toESM(require("execa"), 1);
|
|
37
37
|
var import_project_config = require("@cedarjs/project-config");
|
|
38
38
|
var import_directUrlHelpers = require("@cedarjs/testing/dist/cjs/api/directUrlHelpers.js");
|
|
39
|
+
const { getSchemaWithPath } = import_internals.default;
|
|
39
40
|
const rwjsPaths = (0, import_project_config.getPaths)();
|
|
40
41
|
async function globalSetup_default() {
|
|
41
42
|
if (process.env.SKIP_DB_PUSH === "1") {
|
|
@@ -43,7 +44,9 @@ async function globalSetup_default() {
|
|
|
43
44
|
}
|
|
44
45
|
const defaultDb = (0, import_directUrlHelpers.getDefaultDb)(rwjsPaths.base);
|
|
45
46
|
process.env.DATABASE_URL = process.env.TEST_DATABASE_URL || defaultDb;
|
|
46
|
-
const
|
|
47
|
+
const schemaPath = await (0, import_project_config.getSchemaPath)(rwjsPaths.api.prismaConfig);
|
|
48
|
+
const result = await getSchemaWithPath(schemaPath);
|
|
49
|
+
const prismaSchema = result.schemas.map(([, content]) => content).join("\n");
|
|
47
50
|
const directUrlEnvVar = (0, import_directUrlHelpers.checkAndReplaceDirectUrl)(prismaSchema, defaultDb);
|
|
48
51
|
const command = process.env.TEST_DATABASE_STRATEGY === "reset" ? ["prisma", "migrate", "reset", "--force", "--skip-seed"] : ["prisma", "db", "push", "--force-reset", "--accept-data-loss"];
|
|
49
52
|
const env = {
|
|
@@ -24,7 +24,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
var import_node_fs = __toESM(require("node:fs"), 1);
|
|
25
25
|
var import_node_path = __toESM(require("node:path"), 1);
|
|
26
26
|
var import_scenario = require("@cedarjs/testing/dist/cjs/api/scenario.js");
|
|
27
|
-
const { apiSrcPath, tearDownCachePath,
|
|
27
|
+
const { apiSrcPath, tearDownCachePath, prismaConfigPath } = global.__RWJS__TEST_IMPORTS;
|
|
28
28
|
global.defineScenario = import_scenario.defineScenario;
|
|
29
29
|
const mockContextStore = /* @__PURE__ */ new Map();
|
|
30
30
|
const mockContext = new Proxy(
|
|
@@ -58,9 +58,11 @@ const isIdenticalArray = (a, b) => {
|
|
|
58
58
|
return JSON.stringify(a) === JSON.stringify(b);
|
|
59
59
|
};
|
|
60
60
|
const configureTeardown = async () => {
|
|
61
|
-
const { getDMMF,
|
|
62
|
-
const
|
|
63
|
-
const
|
|
61
|
+
const { getDMMF, getSchemaWithPath } = require("@prisma/internals");
|
|
62
|
+
const { getSchemaPath } = require("@cedarjs/project-config");
|
|
63
|
+
const schemaPath = await getSchemaPath(prismaConfigPath);
|
|
64
|
+
const { schemas } = await getSchemaWithPath(schemaPath);
|
|
65
|
+
const schema = await getDMMF({ datamodel: schemas });
|
|
64
66
|
const schemaModels = schema.datamodel.models.map(
|
|
65
67
|
(m) => m.dbName || m.name
|
|
66
68
|
);
|
|
@@ -74,11 +76,13 @@ const configureTeardown = async () => {
|
|
|
74
76
|
};
|
|
75
77
|
let quoteStyle;
|
|
76
78
|
const getQuoteStyle = async () => {
|
|
77
|
-
const { getConfig: getPrismaConfig,
|
|
78
|
-
const
|
|
79
|
+
const { getConfig: getPrismaConfig, getSchemaWithPath } = require("@prisma/internals");
|
|
80
|
+
const { getSchemaPath } = require("@cedarjs/project-config");
|
|
81
|
+
const schemaPath = await getSchemaPath(prismaConfigPath);
|
|
82
|
+
const result = await getSchemaWithPath(schemaPath);
|
|
79
83
|
if (!quoteStyle) {
|
|
80
84
|
const config = await getPrismaConfig({
|
|
81
|
-
datamodel
|
|
85
|
+
datamodel: result.schemas
|
|
82
86
|
});
|
|
83
87
|
switch (config.datasources?.[0]?.provider) {
|
|
84
88
|
case "mysql":
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CedarApiVitestEnv.d.ts","sourceRoot":"","sources":["../../../src/api/vitest/CedarApiVitestEnv.ts"],"names":[],"mappings":"AACA,OAAO,2BAA2B,CAAA;AAElC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"CedarApiVitestEnv.d.ts","sourceRoot":"","sources":["../../../src/api/vitest/CedarApiVitestEnv.ts"],"names":[],"mappings":"AACA,OAAO,2BAA2B,CAAA;AAElC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAQtD,QAAA,MAAM,yBAAyB,EAAE,WAkDhC,CAAA;AAED,eAAe,yBAAyB,CAAA"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import prismaInternals from "@prisma/internals";
|
|
2
2
|
import "dotenv-defaults/config.js";
|
|
3
3
|
import execa from "execa";
|
|
4
|
-
import { getPaths } from "@cedarjs/project-config";
|
|
4
|
+
import { getPaths, getSchemaPath } from "@cedarjs/project-config";
|
|
5
5
|
import { getDefaultDb, checkAndReplaceDirectUrl } from "../directUrlHelpers.js";
|
|
6
|
+
const { getSchemaWithPath } = prismaInternals;
|
|
6
7
|
const CedarApiVitestEnvironment = {
|
|
7
8
|
name: "cedar-api",
|
|
8
9
|
transformMode: "ssr",
|
|
@@ -16,7 +17,9 @@ const CedarApiVitestEnvironment = {
|
|
|
16
17
|
const cedarPaths = getPaths();
|
|
17
18
|
const defaultDb = getDefaultDb(cedarPaths.base);
|
|
18
19
|
process.env.DATABASE_URL = process.env.TEST_DATABASE_URL || defaultDb;
|
|
19
|
-
const
|
|
20
|
+
const schemaPath = await getSchemaPath(cedarPaths.api.prismaConfig);
|
|
21
|
+
const result = await getSchemaWithPath(schemaPath);
|
|
22
|
+
const prismaSchema = result.schemas.map(([, content]) => content).join("\n");
|
|
20
23
|
const directUrlEnvVar = checkAndReplaceDirectUrl(prismaSchema, defaultDb);
|
|
21
24
|
const command = process.env.TEST_DATABASE_STRATEGY === "reset" ? ["prisma", "migrate", "reset", "--force", "--skip-seed"] : ["prisma", "db", "push", "--force-reset", "--accept-data-loss"];
|
|
22
25
|
const directUrlDefinition = directUrlEnvVar ? { [directUrlEnvVar]: process.env[directUrlEnvVar] } : {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { afterAll, beforeEach, it, describe, vi, beforeAll } from "vitest";
|
|
4
|
-
import { getPaths } from "@cedarjs/project-config";
|
|
4
|
+
import { getPaths, getSchemaPath } from "@cedarjs/project-config";
|
|
5
5
|
import { defineScenario } from "@cedarjs/testing/api";
|
|
6
6
|
const mockContextStore = vi.hoisted(() => /* @__PURE__ */ new Map());
|
|
7
7
|
const mockContext = vi.hoisted(
|
|
@@ -106,9 +106,10 @@ async function configureTeardown() {
|
|
|
106
106
|
if (!wasDbImported()) {
|
|
107
107
|
return;
|
|
108
108
|
}
|
|
109
|
-
const { getDMMF,
|
|
110
|
-
const
|
|
111
|
-
const
|
|
109
|
+
const { getDMMF, getSchemaWithPath } = await import("@prisma/internals");
|
|
110
|
+
const schemaPath = await getSchemaPath(cedarPaths.api.prismaConfig);
|
|
111
|
+
const result = await getSchemaWithPath(schemaPath);
|
|
112
|
+
const schema = await getDMMF({ datamodel: result.schemas });
|
|
112
113
|
const schemaModels = schema.datamodel.models.map((m) => {
|
|
113
114
|
return m.dbName || m.name;
|
|
114
115
|
});
|
|
@@ -209,11 +210,12 @@ const wasDbImported = () => {
|
|
|
209
210
|
};
|
|
210
211
|
let quoteStyle;
|
|
211
212
|
async function getQuoteStyle() {
|
|
212
|
-
const { getConfig: getPrismaConfig,
|
|
213
|
-
const
|
|
213
|
+
const { getConfig: getPrismaConfig, getSchemaWithPath } = await import("@prisma/internals");
|
|
214
|
+
const schemaPath = await getSchemaPath(cedarPaths.api.prismaConfig);
|
|
215
|
+
const result = await getSchemaWithPath(schemaPath);
|
|
214
216
|
if (!quoteStyle) {
|
|
215
217
|
const config = await getPrismaConfig({
|
|
216
|
-
datamodel
|
|
218
|
+
datamodel: result.schemas
|
|
217
219
|
});
|
|
218
220
|
switch (config.datasources?.[0]?.provider) {
|
|
219
221
|
case "mysql":
|
|
@@ -31,11 +31,12 @@ __export(CedarApiVitestEnv_exports, {
|
|
|
31
31
|
default: () => CedarApiVitestEnv_default
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(CedarApiVitestEnv_exports);
|
|
34
|
-
var import_internals = require("@prisma/internals");
|
|
34
|
+
var import_internals = __toESM(require("@prisma/internals"), 1);
|
|
35
35
|
var import_config = require("dotenv-defaults/config.js");
|
|
36
36
|
var import_execa = __toESM(require("execa"), 1);
|
|
37
37
|
var import_project_config = require("@cedarjs/project-config");
|
|
38
38
|
var import_directUrlHelpers = require("../directUrlHelpers.js");
|
|
39
|
+
const { getSchemaWithPath } = import_internals.default;
|
|
39
40
|
const CedarApiVitestEnvironment = {
|
|
40
41
|
name: "cedar-api",
|
|
41
42
|
transformMode: "ssr",
|
|
@@ -49,7 +50,9 @@ const CedarApiVitestEnvironment = {
|
|
|
49
50
|
const cedarPaths = (0, import_project_config.getPaths)();
|
|
50
51
|
const defaultDb = (0, import_directUrlHelpers.getDefaultDb)(cedarPaths.base);
|
|
51
52
|
process.env.DATABASE_URL = process.env.TEST_DATABASE_URL || defaultDb;
|
|
52
|
-
const
|
|
53
|
+
const schemaPath = await (0, import_project_config.getSchemaPath)(cedarPaths.api.prismaConfig);
|
|
54
|
+
const result = await getSchemaWithPath(schemaPath);
|
|
55
|
+
const prismaSchema = result.schemas.map(([, content]) => content).join("\n");
|
|
53
56
|
const directUrlEnvVar = (0, import_directUrlHelpers.checkAndReplaceDirectUrl)(prismaSchema, defaultDb);
|
|
54
57
|
const command = process.env.TEST_DATABASE_STRATEGY === "reset" ? ["prisma", "migrate", "reset", "--force", "--skip-seed"] : ["prisma", "db", "push", "--force-reset", "--accept-data-loss"];
|
|
55
58
|
const directUrlDefinition = directUrlEnvVar ? { [directUrlEnvVar]: process.env[directUrlEnvVar] } : {};
|
|
@@ -129,9 +129,10 @@ async function configureTeardown() {
|
|
|
129
129
|
if (!wasDbImported()) {
|
|
130
130
|
return;
|
|
131
131
|
}
|
|
132
|
-
const { getDMMF,
|
|
133
|
-
const
|
|
134
|
-
const
|
|
132
|
+
const { getDMMF, getSchemaWithPath } = await import("@prisma/internals");
|
|
133
|
+
const schemaPath = await (0, import_project_config.getSchemaPath)(cedarPaths.api.prismaConfig);
|
|
134
|
+
const result = await getSchemaWithPath(schemaPath);
|
|
135
|
+
const schema = await getDMMF({ datamodel: result.schemas });
|
|
135
136
|
const schemaModels = schema.datamodel.models.map((m) => {
|
|
136
137
|
return m.dbName || m.name;
|
|
137
138
|
});
|
|
@@ -232,11 +233,12 @@ const wasDbImported = () => {
|
|
|
232
233
|
};
|
|
233
234
|
let quoteStyle;
|
|
234
235
|
async function getQuoteStyle() {
|
|
235
|
-
const { getConfig: getPrismaConfig,
|
|
236
|
-
const
|
|
236
|
+
const { getConfig: getPrismaConfig, getSchemaWithPath } = await import("@prisma/internals");
|
|
237
|
+
const schemaPath = await (0, import_project_config.getSchemaPath)(cedarPaths.api.prismaConfig);
|
|
238
|
+
const result = await getSchemaWithPath(schemaPath);
|
|
237
239
|
if (!quoteStyle) {
|
|
238
240
|
const config = await getPrismaConfig({
|
|
239
|
-
datamodel
|
|
241
|
+
datamodel: result.schemas
|
|
240
242
|
});
|
|
241
243
|
switch (config.datasources?.[0]?.provider) {
|
|
242
244
|
case "mysql":
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globalSetup.d.ts","sourceRoot":"","sources":["../../../../../src/config/jest/api/globalSetup.ts"],"names":[],"mappings":"AACA,OAAO,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"globalSetup.d.ts","sourceRoot":"","sources":["../../../../../src/config/jest/api/globalSetup.ts"],"names":[],"mappings":"AACA,OAAO,wBAAwB,CAAA;AAc/B,0CAuCC"}
|
|
@@ -31,11 +31,12 @@ __export(globalSetup_exports, {
|
|
|
31
31
|
default: () => globalSetup_default
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(globalSetup_exports);
|
|
34
|
-
var import_internals = require("@prisma/internals");
|
|
34
|
+
var import_internals = __toESM(require("@prisma/internals"), 1);
|
|
35
35
|
var import_config = require("dotenv-defaults/config");
|
|
36
36
|
var import_execa = __toESM(require("execa"), 1);
|
|
37
37
|
var import_project_config = require("@cedarjs/project-config");
|
|
38
38
|
var import_directUrlHelpers = require("../../../api/directUrlHelpers.js");
|
|
39
|
+
const { getSchemaWithPath } = import_internals.default;
|
|
39
40
|
const rwjsPaths = (0, import_project_config.getPaths)();
|
|
40
41
|
async function globalSetup_default() {
|
|
41
42
|
if (process.env.SKIP_DB_PUSH === "1") {
|
|
@@ -43,7 +44,9 @@ async function globalSetup_default() {
|
|
|
43
44
|
}
|
|
44
45
|
const defaultDb = (0, import_directUrlHelpers.getDefaultDb)(rwjsPaths.base);
|
|
45
46
|
process.env.DATABASE_URL = process.env.TEST_DATABASE_URL || defaultDb;
|
|
46
|
-
const
|
|
47
|
+
const schemaPath = await (0, import_project_config.getSchemaPath)(rwjsPaths.api.prismaConfig);
|
|
48
|
+
const result = await getSchemaWithPath(schemaPath);
|
|
49
|
+
const prismaSchema = result.schemas.map(([, content]) => content).join("\n");
|
|
47
50
|
const directUrlEnvVar = (0, import_directUrlHelpers.checkAndReplaceDirectUrl)(prismaSchema, defaultDb);
|
|
48
51
|
const command = process.env.TEST_DATABASE_STRATEGY === "reset" ? ["prisma", "migrate", "reset", "--force", "--skip-seed"] : ["prisma", "db", "push", "--force-reset", "--accept-data-loss"];
|
|
49
52
|
const env = {
|
|
@@ -24,7 +24,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
var import_node_fs = __toESM(require("node:fs"), 1);
|
|
25
25
|
var import_node_path = __toESM(require("node:path"), 1);
|
|
26
26
|
var import_scenario = require("../../../api/scenario.js");
|
|
27
|
-
const { apiSrcPath, tearDownCachePath,
|
|
27
|
+
const { apiSrcPath, tearDownCachePath, prismaConfigPath } = global.__RWJS__TEST_IMPORTS;
|
|
28
28
|
global.defineScenario = import_scenario.defineScenario;
|
|
29
29
|
const mockContextStore = /* @__PURE__ */ new Map();
|
|
30
30
|
const mockContext = new Proxy(
|
|
@@ -58,9 +58,11 @@ const isIdenticalArray = (a, b) => {
|
|
|
58
58
|
return JSON.stringify(a) === JSON.stringify(b);
|
|
59
59
|
};
|
|
60
60
|
const configureTeardown = async () => {
|
|
61
|
-
const { getDMMF,
|
|
62
|
-
const
|
|
63
|
-
const
|
|
61
|
+
const { getDMMF, getSchemaWithPath } = await import("@prisma/internals");
|
|
62
|
+
const { getSchemaPath } = await import("@cedarjs/project-config");
|
|
63
|
+
const schemaPath = await getSchemaPath(prismaConfigPath);
|
|
64
|
+
const { schemas } = await getSchemaWithPath(schemaPath);
|
|
65
|
+
const schema = await getDMMF({ datamodel: schemas });
|
|
64
66
|
const schemaModels = schema.datamodel.models.map(
|
|
65
67
|
(m) => m.dbName || m.name
|
|
66
68
|
);
|
|
@@ -74,11 +76,13 @@ const configureTeardown = async () => {
|
|
|
74
76
|
};
|
|
75
77
|
let quoteStyle;
|
|
76
78
|
const getQuoteStyle = async () => {
|
|
77
|
-
const { getConfig: getPrismaConfig,
|
|
78
|
-
const
|
|
79
|
+
const { getConfig: getPrismaConfig, getSchemaWithPath } = await import("@prisma/internals");
|
|
80
|
+
const { getSchemaPath } = await import("@cedarjs/project-config");
|
|
81
|
+
const schemaPath = await getSchemaPath(prismaConfigPath);
|
|
82
|
+
const result = await getSchemaWithPath(schemaPath);
|
|
79
83
|
if (!quoteStyle) {
|
|
80
84
|
const config = await getPrismaConfig({
|
|
81
|
-
datamodel
|
|
85
|
+
datamodel: result.schemas
|
|
82
86
|
});
|
|
83
87
|
switch (config.datasources?.[0]?.provider) {
|
|
84
88
|
case "mysql":
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globalSetup.d.ts","sourceRoot":"","sources":["../../../../src/config/jest/api/globalSetup.ts"],"names":[],"mappings":"AACA,OAAO,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"globalSetup.d.ts","sourceRoot":"","sources":["../../../../src/config/jest/api/globalSetup.ts"],"names":[],"mappings":"AACA,OAAO,wBAAwB,CAAA;AAc/B,0CAuCC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import prismaInternals from "@prisma/internals";
|
|
2
2
|
import "dotenv-defaults/config";
|
|
3
3
|
import execa from "execa";
|
|
4
|
-
import { getPaths } from "@cedarjs/project-config";
|
|
4
|
+
import { getPaths, getSchemaPath } from "@cedarjs/project-config";
|
|
5
5
|
import {
|
|
6
6
|
getDefaultDb,
|
|
7
7
|
checkAndReplaceDirectUrl
|
|
8
8
|
} from "../../../api/directUrlHelpers.js";
|
|
9
|
+
const { getSchemaWithPath } = prismaInternals;
|
|
9
10
|
const rwjsPaths = getPaths();
|
|
10
11
|
async function globalSetup_default() {
|
|
11
12
|
if (process.env.SKIP_DB_PUSH === "1") {
|
|
@@ -13,7 +14,9 @@ async function globalSetup_default() {
|
|
|
13
14
|
}
|
|
14
15
|
const defaultDb = getDefaultDb(rwjsPaths.base);
|
|
15
16
|
process.env.DATABASE_URL = process.env.TEST_DATABASE_URL || defaultDb;
|
|
16
|
-
const
|
|
17
|
+
const schemaPath = await getSchemaPath(rwjsPaths.api.prismaConfig);
|
|
18
|
+
const result = await getSchemaWithPath(schemaPath);
|
|
19
|
+
const prismaSchema = result.schemas.map(([, content]) => content).join("\n");
|
|
17
20
|
const directUrlEnvVar = checkAndReplaceDirectUrl(prismaSchema, defaultDb);
|
|
18
21
|
const command = process.env.TEST_DATABASE_STRATEGY === "reset" ? ["prisma", "migrate", "reset", "--force", "--skip-seed"] : ["prisma", "db", "push", "--force-reset", "--accept-data-loss"];
|
|
19
22
|
const env = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { defineScenario } from "../../../api/scenario.js";
|
|
4
|
-
const { apiSrcPath, tearDownCachePath,
|
|
4
|
+
const { apiSrcPath, tearDownCachePath, prismaConfigPath } = global.__RWJS__TEST_IMPORTS;
|
|
5
5
|
global.defineScenario = defineScenario;
|
|
6
6
|
const mockContextStore = /* @__PURE__ */ new Map();
|
|
7
7
|
const mockContext = new Proxy(
|
|
@@ -35,9 +35,11 @@ const isIdenticalArray = (a, b) => {
|
|
|
35
35
|
return JSON.stringify(a) === JSON.stringify(b);
|
|
36
36
|
};
|
|
37
37
|
const configureTeardown = async () => {
|
|
38
|
-
const { getDMMF,
|
|
39
|
-
const
|
|
40
|
-
const
|
|
38
|
+
const { getDMMF, getSchemaWithPath } = await import("@prisma/internals");
|
|
39
|
+
const { getSchemaPath } = await import("@cedarjs/project-config");
|
|
40
|
+
const schemaPath = await getSchemaPath(prismaConfigPath);
|
|
41
|
+
const { schemas } = await getSchemaWithPath(schemaPath);
|
|
42
|
+
const schema = await getDMMF({ datamodel: schemas });
|
|
41
43
|
const schemaModels = schema.datamodel.models.map(
|
|
42
44
|
(m) => m.dbName || m.name
|
|
43
45
|
);
|
|
@@ -51,11 +53,13 @@ const configureTeardown = async () => {
|
|
|
51
53
|
};
|
|
52
54
|
let quoteStyle;
|
|
53
55
|
const getQuoteStyle = async () => {
|
|
54
|
-
const { getConfig: getPrismaConfig,
|
|
55
|
-
const
|
|
56
|
+
const { getConfig: getPrismaConfig, getSchemaWithPath } = await import("@prisma/internals");
|
|
57
|
+
const { getSchemaPath } = await import("@cedarjs/project-config");
|
|
58
|
+
const schemaPath = await getSchemaPath(prismaConfigPath);
|
|
59
|
+
const result = await getSchemaWithPath(schemaPath);
|
|
56
60
|
if (!quoteStyle) {
|
|
57
61
|
const config = await getPrismaConfig({
|
|
58
|
-
datamodel
|
|
62
|
+
datamodel: result.schemas
|
|
59
63
|
});
|
|
60
64
|
switch (config.datasources?.[0]?.provider) {
|
|
61
65
|
case "mysql":
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/testing",
|
|
3
|
-
"version": "1.1.1-next.
|
|
3
|
+
"version": "1.1.1-next.18+5ffd3124d",
|
|
4
4
|
"description": "Tools, wrappers and configuration for testing a CedarJS project.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -119,13 +119,13 @@
|
|
|
119
119
|
"test:watch": "vitest watch"
|
|
120
120
|
},
|
|
121
121
|
"dependencies": {
|
|
122
|
-
"@cedarjs/auth": "1.1.1-next.
|
|
123
|
-
"@cedarjs/babel-config": "1.1.1-next.
|
|
124
|
-
"@cedarjs/context": "1.1.1-next.
|
|
125
|
-
"@cedarjs/graphql-server": "1.1.1-next.
|
|
126
|
-
"@cedarjs/project-config": "1.1.1-next.
|
|
127
|
-
"@cedarjs/router": "1.1.1-next.
|
|
128
|
-
"@cedarjs/web": "1.1.1-next.
|
|
122
|
+
"@cedarjs/auth": "1.1.1-next.18+5ffd3124d",
|
|
123
|
+
"@cedarjs/babel-config": "1.1.1-next.18+5ffd3124d",
|
|
124
|
+
"@cedarjs/context": "1.1.1-next.18+5ffd3124d",
|
|
125
|
+
"@cedarjs/graphql-server": "1.1.1-next.18+5ffd3124d",
|
|
126
|
+
"@cedarjs/project-config": "1.1.1-next.18+5ffd3124d",
|
|
127
|
+
"@cedarjs/router": "1.1.1-next.18+5ffd3124d",
|
|
128
|
+
"@cedarjs/web": "1.1.1-next.18+5ffd3124d",
|
|
129
129
|
"@testing-library/jest-dom": "6.5.0",
|
|
130
130
|
"@testing-library/react": "14.3.1",
|
|
131
131
|
"@testing-library/user-event": "14.5.2",
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
"whatwg-fetch": "3.6.20"
|
|
146
146
|
},
|
|
147
147
|
"devDependencies": {
|
|
148
|
-
"@cedarjs/framework-tools": "1.1.1-next.
|
|
148
|
+
"@cedarjs/framework-tools": "1.1.1-next.18",
|
|
149
149
|
"concurrently": "8.2.2",
|
|
150
150
|
"jsdom": "24.1.3",
|
|
151
151
|
"publint": "0.3.12",
|
|
@@ -164,7 +164,7 @@
|
|
|
164
164
|
"publishConfig": {
|
|
165
165
|
"access": "public"
|
|
166
166
|
},
|
|
167
|
-
"gitHead": "
|
|
167
|
+
"gitHead": "5ffd3124d3d4ceb7843408264c96ecceff8542f5",
|
|
168
168
|
"nx": {
|
|
169
169
|
"targets": {
|
|
170
170
|
"build": {
|