@cedarjs/testing 5.0.7-next.338 → 5.0.7

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.
Files changed (103) hide show
  1. package/config/jest/api/apiBabelConfig.d.ts.map +1 -1
  2. package/config/jest/api/apiBabelConfig.js +3 -1
  3. package/config/jest/api/globalSetup.d.ts.map +1 -1
  4. package/config/jest/api/globalSetup.js +0 -9
  5. package/config/jest/api/jest-preset.d.ts.map +1 -1
  6. package/config/jest/api/jest-preset.js +3 -38
  7. package/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts.map +1 -1
  8. package/config/jest/babelPlugins/babel-plugin-redwood-cell.js +1 -2
  9. package/config/jest/web/RedwoodWebJestEnv.d.ts +2 -2
  10. package/config/jest/web/RedwoodWebJestEnv.d.ts.map +1 -1
  11. package/config/jest/web/RedwoodWebJestEnv.js +7 -12
  12. package/config/jest/web/jest-preset.d.ts.map +1 -1
  13. package/config/jest/web/jest-preset.js +30 -135
  14. package/config/jest/web/jest.setup.d.ts +1 -0
  15. package/config/jest/web/jest.setup.d.ts.map +1 -1
  16. package/config/jest/web/jest.setup.js +1 -0
  17. package/dist/api/vitest/CedarApiVitestEnv.d.ts.map +1 -1
  18. package/dist/api/vitest/CedarApiVitestEnv.js +1 -13
  19. package/dist/api/vitest/vite-plugin-cedar-vitest-api-config.js +7 -7
  20. package/dist/api/vitest/vitest-api.setup.js +4 -4
  21. package/dist/cjs/api/vitest/CedarApiVitestEnv.js +1 -10
  22. package/dist/cjs/api/vitest/vite-plugin-cedar-vitest-api-config.js +7 -7
  23. package/dist/cjs/api/vitest/vitest-api.setup.js +4 -4
  24. package/dist/cjs/config/jest/api/apiBabelConfig.d.ts.map +1 -1
  25. package/dist/cjs/config/jest/api/apiBabelConfig.js +3 -1
  26. package/dist/cjs/config/jest/api/globalSetup.d.ts.map +1 -1
  27. package/dist/cjs/config/jest/api/globalSetup.js +0 -9
  28. package/dist/cjs/config/jest/api/jest-preset.d.ts.map +1 -1
  29. package/dist/cjs/config/jest/api/jest-preset.js +3 -38
  30. package/dist/cjs/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts.map +1 -1
  31. package/dist/cjs/config/jest/babelPlugins/babel-plugin-redwood-cell.js +1 -2
  32. package/dist/cjs/config/jest/web/RedwoodWebJestEnv.d.ts +2 -2
  33. package/dist/cjs/config/jest/web/RedwoodWebJestEnv.d.ts.map +1 -1
  34. package/dist/cjs/config/jest/web/RedwoodWebJestEnv.js +7 -12
  35. package/dist/cjs/config/jest/web/jest-preset.d.ts.map +1 -1
  36. package/dist/cjs/config/jest/web/jest-preset.js +30 -135
  37. package/dist/cjs/config/jest/web/jest.setup.d.ts +1 -0
  38. package/dist/cjs/config/jest/web/jest.setup.d.ts.map +1 -1
  39. package/dist/cjs/config/jest/web/jest.setup.js +1 -0
  40. package/dist/cjs/web/MockProviders.js +3 -9
  41. package/dist/cjs/web/fileMock.d.ts +4 -5
  42. package/dist/cjs/web/fileMock.d.ts.map +1 -1
  43. package/dist/cjs/web/mockRequests.d.ts +18 -60
  44. package/dist/cjs/web/mockRequests.d.ts.map +1 -1
  45. package/dist/cjs/web/mockRequests.js +36 -107
  46. package/dist/cjs/web/vitest/index.d.ts +4 -0
  47. package/dist/cjs/web/vitest/index.d.ts.map +1 -0
  48. package/dist/cjs/web/vitest/index.js +0 -3
  49. package/dist/cjs/web/vitest/vite-plugin-auto-import.d.ts +2 -0
  50. package/dist/cjs/web/vitest/vite-plugin-auto-import.d.ts.map +1 -0
  51. package/dist/cjs/web/vitest/vite-plugin-cedarjs-router-import-transform.d.ts +7 -0
  52. package/dist/cjs/web/vitest/vite-plugin-cedarjs-router-import-transform.d.ts.map +1 -0
  53. package/dist/cjs/web/vitest/vite-plugin-create-auth-import-transform.d.ts +3 -0
  54. package/dist/cjs/web/vitest/vite-plugin-create-auth-import-transform.d.ts.map +1 -0
  55. package/dist/config/jest/api/apiBabelConfig.d.ts.map +1 -1
  56. package/dist/config/jest/api/apiBabelConfig.js +3 -1
  57. package/dist/config/jest/api/globalSetup.d.ts.map +1 -1
  58. package/dist/config/jest/api/globalSetup.js +0 -12
  59. package/dist/config/jest/api/index.js +1 -5
  60. package/dist/config/jest/api/jest-preset.d.ts.map +1 -1
  61. package/dist/config/jest/api/jest-preset.js +3 -38
  62. package/dist/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts.map +1 -1
  63. package/dist/config/jest/babelPlugins/babel-plugin-redwood-cell.js +1 -2
  64. package/dist/config/jest/jest-serial-runner.js +1 -5
  65. package/dist/config/jest/web/RedwoodWebJestEnv.d.ts +2 -2
  66. package/dist/config/jest/web/RedwoodWebJestEnv.d.ts.map +1 -1
  67. package/dist/config/jest/web/RedwoodWebJestEnv.js +7 -2
  68. package/dist/config/jest/web/index.js +1 -5
  69. package/dist/config/jest/web/jest-preset.d.ts.map +1 -1
  70. package/dist/config/jest/web/jest-preset.js +30 -135
  71. package/dist/config/jest/web/jest.setup.d.ts +1 -0
  72. package/dist/config/jest/web/jest.setup.d.ts.map +1 -1
  73. package/dist/config/jest/web/jest.setup.js +1 -0
  74. package/dist/config/jest/web/resolver.js +1 -5
  75. package/dist/web/MockProviders.js +4 -10
  76. package/dist/web/fileMock.d.ts +4 -5
  77. package/dist/web/fileMock.d.ts.map +1 -1
  78. package/dist/web/mockRequests.d.ts +18 -60
  79. package/dist/web/mockRequests.d.ts.map +1 -1
  80. package/dist/web/mockRequests.js +37 -108
  81. package/dist/web/vitest/index.d.ts +0 -1
  82. package/dist/web/vitest/index.d.ts.map +1 -1
  83. package/dist/web/vitest/index.js +0 -2
  84. package/dist/web/vitest/vite-plugin-cedarjs-router-import-transform.d.ts.map +1 -1
  85. package/dist/web/vitest/vite-plugin-create-auth-import-transform.d.ts.map +1 -1
  86. package/package.json +22 -27
  87. package/config/jest/web/jest-fixed-jsdom.d.js +0 -1
  88. package/dist/api/checkTestDatabase.d.ts +0 -23
  89. package/dist/api/checkTestDatabase.d.ts.map +0 -1
  90. package/dist/api/checkTestDatabase.js +0 -44
  91. package/dist/cjs/api/checkTestDatabase.d.ts +0 -23
  92. package/dist/cjs/api/checkTestDatabase.d.ts.map +0 -1
  93. package/dist/cjs/api/checkTestDatabase.js +0 -69
  94. package/dist/cjs/config/jest/web/jest-fixed-jsdom.d.js +0 -1
  95. package/dist/cjs/web/vitest/vite-plugin-cedar-vitest-web-config.js +0 -51
  96. package/dist/cjs/web/vitest/vitest-web.setup.js +0 -19
  97. package/dist/config/jest/web/jest-fixed-jsdom.d.js +0 -0
  98. package/dist/web/vitest/vite-plugin-cedar-vitest-web-config.d.ts +0 -12
  99. package/dist/web/vitest/vite-plugin-cedar-vitest-web-config.d.ts.map +0 -1
  100. package/dist/web/vitest/vite-plugin-cedar-vitest-web-config.js +0 -16
  101. package/dist/web/vitest/vitest-web.setup.d.ts +0 -2
  102. package/dist/web/vitest/vitest-web.setup.d.ts.map +0 -1
  103. package/dist/web/vitest/vitest-web.setup.js +0 -18
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/testing",
3
- "version": "5.0.7-next.338",
3
+ "version": "5.0.7",
4
4
  "description": "Tools, wrappers and configuration for testing a Cedar project.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,9 +25,6 @@
25
25
  "./dist/cjs/api/scenario.js": {
26
26
  "default": "./dist/cjs/api/scenario.js"
27
27
  },
28
- "./dist/cjs/api/checkTestDatabase.js": {
29
- "default": "./dist/cjs/api/checkTestDatabase.js"
30
- },
31
28
  "./dist/cjs/web/findCellMocks": {
32
29
  "default": "./dist/cjs/web/findCellMocks.js"
33
30
  },
@@ -119,47 +116,45 @@
119
116
  "test:watch": "vitest watch"
120
117
  },
121
118
  "dependencies": {
122
- "@babel/preset-env": "7.29.7",
123
- "@cedarjs/babel-config": "5.0.7-next.338",
124
- "@cedarjs/context": "5.0.7-next.338",
125
- "@cedarjs/graphql-server": "5.0.7-next.338",
126
- "@cedarjs/project-config": "5.0.7-next.338",
127
- "@testing-library/dom": "10.4.1",
119
+ "@cedarjs/babel-config": "5.0.7",
120
+ "@cedarjs/context": "5.0.7",
121
+ "@cedarjs/graphql-server": "5.0.7",
122
+ "@cedarjs/project-config": "5.0.7",
128
123
  "@testing-library/jest-dom": "6.9.1",
129
- "@testing-library/react": "16.3.2",
130
- "@testing-library/user-event": "14.6.4",
124
+ "@testing-library/react": "14.3.1",
125
+ "@testing-library/user-event": "14.6.1",
131
126
  "@types/aws-lambda": "8.10.162",
132
127
  "@types/babel-core": "6.25.10",
133
128
  "@types/jest": "29.5.14",
134
129
  "@types/node": "24.10.4",
135
- "ansis": "4.3.1",
130
+ "ansis": "4.2.0",
136
131
  "babel-jest": "^29.7.0",
137
132
  "fast-glob": "3.3.3",
138
133
  "jest": "29.7.0",
139
134
  "jest-environment-jsdom": "29.7.0",
140
- "jest-fixed-jsdom": "0.0.11",
141
135
  "jest-watch-typeahead": "2.2.2",
142
- "msw": "2.15.0",
136
+ "msw": "1.3.5",
143
137
  "ts-toolbelt": "9.6.0",
144
- "unplugin-auto-import": "19.3.0"
138
+ "unplugin-auto-import": "19.3.0",
139
+ "whatwg-fetch": "3.6.20"
145
140
  },
146
141
  "devDependencies": {
147
- "@arethetypeswrong/cli": "0.18.5",
148
- "@cedarjs/auth": "5.0.7-next.338",
149
- "@cedarjs/framework-tools": "5.0.7-next.338",
150
- "@cedarjs/router": "5.0.7-next.338",
151
- "@cedarjs/web": "5.0.7-next.338",
142
+ "@arethetypeswrong/cli": "0.18.4",
143
+ "@cedarjs/auth": "5.0.7",
144
+ "@cedarjs/framework-tools": "5.0.7",
145
+ "@cedarjs/router": "5.0.7",
146
+ "@cedarjs/web": "5.0.7",
152
147
  "concurrently": "9.2.4",
153
148
  "jsdom": "27.4.0",
154
- "publint": "0.3.23",
149
+ "publint": "0.3.21",
155
150
  "typescript": "5.9.3",
156
- "vitest": "4.1.10"
151
+ "vitest": "3.2.6"
157
152
  },
158
153
  "peerDependencies": {
159
- "@cedarjs/auth": "5.0.7-next.338",
160
- "@cedarjs/router": "5.0.7-next.338",
161
- "@cedarjs/web": "5.0.7-next.338",
162
- "vitest": "4.1.10"
154
+ "@cedarjs/auth": "5.0.7",
155
+ "@cedarjs/router": "5.0.7",
156
+ "@cedarjs/web": "5.0.7",
157
+ "vitest": "3.2.6"
163
158
  },
164
159
  "peerDependenciesMeta": {
165
160
  "vitest": {
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,23 +0,0 @@
1
- /**
2
- * Redacts credentials from a database connection string so it's safe to
3
- * print. Handles both URI-style authority credentials, e.g.
4
- * `postgres://user:pass@host/db` -> `postgres://user:***@host/db`, and
5
- * semicolon-delimited key/value credentials used by SQL Server connection
6
- * strings, e.g. `Server=host;Password=secret;` -> `Server=host;Password=***;`.
7
- */
8
- export declare function redactDatabaseUrl(url: string): string;
9
- /**
10
- * Checks that the `DATABASE_URL` about to be used for tests matches the
11
- * datasource provider configured in `schema.prisma`, and throws an
12
- * actionable error if they don't match.
13
- *
14
- * Without this check, running `prisma db push`/`migrate reset` against a
15
- * mismatched provider/URL combination (e.g. a leftover sqlite fallback URL
16
- * with a `postgresql` schema) can hang indefinitely with no output, instead
17
- * of failing fast. See https://github.com/cedarjs/cedar/issues/2284.
18
- *
19
- * If the provider can't be determined (e.g. `schema.prisma` doesn't exist
20
- * yet), this is a no-op — Prisma itself will surface the problem.
21
- */
22
- export declare function checkTestDatabaseUrlMatchesProvider(databaseUrl: string, usedFallback: boolean): Promise<void>;
23
- //# sourceMappingURL=checkTestDatabase.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"checkTestDatabase.d.ts","sourceRoot":"","sources":["../../src/api/checkTestDatabase.ts"],"names":[],"mappings":"AAkBA;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAIrD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,mCAAmC,CACvD,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,OAAO,iBAmCtB"}
@@ -1,44 +0,0 @@
1
- import { getPrismaDatasourceProvider } from "@cedarjs/project-config";
2
- const PROVIDER_URL_SCHEMES = {
3
- sqlite: ["file:"],
4
- postgresql: ["postgres:", "postgresql:"],
5
- postgres: ["postgres:", "postgresql:"],
6
- cockroachdb: ["postgres:", "postgresql:"],
7
- mysql: ["mysql:"],
8
- sqlserver: ["sqlserver:"],
9
- mongodb: ["mongodb:", "mongodb+srv:"]
10
- };
11
- function getUrlScheme(url) {
12
- const match = url.match(/^([a-z][a-z0-9+.-]*:)/i);
13
- return match?.[1]?.toLowerCase();
14
- }
15
- function redactDatabaseUrl(url) {
16
- return url.replace(/:\/\/([^:/?#]+):([^@/?#]+)@/, "://$1:***@").replace(/((?:^|;)\s*password\s*=)[^;]*/gi, "$1***");
17
- }
18
- async function checkTestDatabaseUrlMatchesProvider(databaseUrl, usedFallback) {
19
- let provider;
20
- try {
21
- provider = await getPrismaDatasourceProvider();
22
- } catch {
23
- return;
24
- }
25
- const expectedSchemes = PROVIDER_URL_SCHEMES[provider];
26
- if (!expectedSchemes) {
27
- return;
28
- }
29
- const actualScheme = getUrlScheme(databaseUrl);
30
- if (actualScheme && expectedSchemes.includes(actualScheme)) {
31
- return;
32
- }
33
- const redactedUrl = redactDatabaseUrl(databaseUrl);
34
- const reason = usedFallback ? `TEST_DATABASE_URL is not set, so the default sqlite test database was used (${redactedUrl}), but your schema.prisma is configured for "${provider}". Set TEST_DATABASE_URL to a "${provider}" connection string to run tests.` : `TEST_DATABASE_URL (${redactedUrl}) does not match the "${provider}" provider configured in schema.prisma. Update TEST_DATABASE_URL to a "${provider}" connection string.`;
35
- throw new Error(
36
- `Test database URL does not match your Prisma schema's provider.
37
-
38
- ${reason}`
39
- );
40
- }
41
- export {
42
- checkTestDatabaseUrlMatchesProvider,
43
- redactDatabaseUrl
44
- };
@@ -1,23 +0,0 @@
1
- /**
2
- * Redacts credentials from a database connection string so it's safe to
3
- * print. Handles both URI-style authority credentials, e.g.
4
- * `postgres://user:pass@host/db` -> `postgres://user:***@host/db`, and
5
- * semicolon-delimited key/value credentials used by SQL Server connection
6
- * strings, e.g. `Server=host;Password=secret;` -> `Server=host;Password=***;`.
7
- */
8
- export declare function redactDatabaseUrl(url: string): string;
9
- /**
10
- * Checks that the `DATABASE_URL` about to be used for tests matches the
11
- * datasource provider configured in `schema.prisma`, and throws an
12
- * actionable error if they don't match.
13
- *
14
- * Without this check, running `prisma db push`/`migrate reset` against a
15
- * mismatched provider/URL combination (e.g. a leftover sqlite fallback URL
16
- * with a `postgresql` schema) can hang indefinitely with no output, instead
17
- * of failing fast. See https://github.com/cedarjs/cedar/issues/2284.
18
- *
19
- * If the provider can't be determined (e.g. `schema.prisma` doesn't exist
20
- * yet), this is a no-op — Prisma itself will surface the problem.
21
- */
22
- export declare function checkTestDatabaseUrlMatchesProvider(databaseUrl: string, usedFallback: boolean): Promise<void>;
23
- //# sourceMappingURL=checkTestDatabase.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"checkTestDatabase.d.ts","sourceRoot":"","sources":["../../../src/api/checkTestDatabase.ts"],"names":[],"mappings":"AAkBA;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAIrD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,mCAAmC,CACvD,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,OAAO,iBAmCtB"}
@@ -1,69 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var checkTestDatabase_exports = {};
20
- __export(checkTestDatabase_exports, {
21
- checkTestDatabaseUrlMatchesProvider: () => checkTestDatabaseUrlMatchesProvider,
22
- redactDatabaseUrl: () => redactDatabaseUrl
23
- });
24
- module.exports = __toCommonJS(checkTestDatabase_exports);
25
- var import_project_config = require("@cedarjs/project-config");
26
- const PROVIDER_URL_SCHEMES = {
27
- sqlite: ["file:"],
28
- postgresql: ["postgres:", "postgresql:"],
29
- postgres: ["postgres:", "postgresql:"],
30
- cockroachdb: ["postgres:", "postgresql:"],
31
- mysql: ["mysql:"],
32
- sqlserver: ["sqlserver:"],
33
- mongodb: ["mongodb:", "mongodb+srv:"]
34
- };
35
- function getUrlScheme(url) {
36
- const match = url.match(/^([a-z][a-z0-9+.-]*:)/i);
37
- return match?.[1]?.toLowerCase();
38
- }
39
- function redactDatabaseUrl(url) {
40
- return url.replace(/:\/\/([^:/?#]+):([^@/?#]+)@/, "://$1:***@").replace(/((?:^|;)\s*password\s*=)[^;]*/gi, "$1***");
41
- }
42
- async function checkTestDatabaseUrlMatchesProvider(databaseUrl, usedFallback) {
43
- let provider;
44
- try {
45
- provider = await (0, import_project_config.getPrismaDatasourceProvider)();
46
- } catch {
47
- return;
48
- }
49
- const expectedSchemes = PROVIDER_URL_SCHEMES[provider];
50
- if (!expectedSchemes) {
51
- return;
52
- }
53
- const actualScheme = getUrlScheme(databaseUrl);
54
- if (actualScheme && expectedSchemes.includes(actualScheme)) {
55
- return;
56
- }
57
- const redactedUrl = redactDatabaseUrl(databaseUrl);
58
- const reason = usedFallback ? `TEST_DATABASE_URL is not set, so the default sqlite test database was used (${redactedUrl}), but your schema.prisma is configured for "${provider}". Set TEST_DATABASE_URL to a "${provider}" connection string to run tests.` : `TEST_DATABASE_URL (${redactedUrl}) does not match the "${provider}" provider configured in schema.prisma. Update TEST_DATABASE_URL to a "${provider}" connection string.`;
59
- throw new Error(
60
- `Test database URL does not match your Prisma schema's provider.
61
-
62
- ${reason}`
63
- );
64
- }
65
- // Annotate the CommonJS export names for ESM import in node:
66
- 0 && (module.exports = {
67
- checkTestDatabaseUrlMatchesProvider,
68
- redactDatabaseUrl
69
- });
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,51 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var vite_plugin_cedar_vitest_web_config_exports = {};
30
- __export(vite_plugin_cedar_vitest_web_config_exports, {
31
- cedarVitestWebConfigPlugin: () => cedarVitestWebConfigPlugin
32
- });
33
- module.exports = __toCommonJS(vite_plugin_cedar_vitest_web_config_exports);
34
- var import_node_path = __toESM(require("node:path"), 1);
35
- const import_meta = {};
36
- function cedarVitestWebConfigPlugin() {
37
- return {
38
- name: "cedar-vitest-web-config",
39
- config: () => {
40
- return {
41
- test: {
42
- setupFiles: [import_node_path.default.join(import_meta.dirname, "vitest-web.setup.js")]
43
- }
44
- };
45
- }
46
- };
47
- }
48
- // Annotate the CommonJS export names for ESM import in node:
49
- 0 && (module.exports = {
50
- cedarVitestWebConfigPlugin
51
- });
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var import_vitest = require("vitest");
3
- var import_project_config = require("@cedarjs/project-config");
4
- var import_findCellMocks = require("../findCellMocks.js");
5
- var import_mockRequests = require("../mockRequests.js");
6
- (0, import_vitest.beforeAll)(async () => {
7
- const cellMocks = (0, import_findCellMocks.findCellMocks)((0, import_project_config.getPaths)().web.src);
8
- for (const m of cellMocks) {
9
- await import(m);
10
- }
11
- await (0, import_mockRequests.startMSW)("node");
12
- (0, import_mockRequests.setupRequestHandlers)();
13
- });
14
- (0, import_vitest.afterEach)(() => {
15
- (0, import_mockRequests.setupRequestHandlers)();
16
- });
17
- (0, import_vitest.afterAll)(() => {
18
- (0, import_mockRequests.closeServer)();
19
- });
File without changes
@@ -1,12 +0,0 @@
1
- import type { Plugin } from 'vite';
2
- /**
3
- * Contributes web-side Vitest config, most importantly a setup file that
4
- * starts MSW so that `mockGraphQLQuery`/`mockGraphQLMutation` handlers (and
5
- * cell mocks) actually intercept GraphQL requests during tests.
6
- *
7
- * Vitest resolves its `test` config from Vite plugins, so returning `test`
8
- * from the `config` hook here merges with the user's own vitest config (the
9
- * `setupFiles` arrays are concatenated).
10
- */
11
- export declare function cedarVitestWebConfigPlugin(): Plugin;
12
- //# sourceMappingURL=vite-plugin-cedar-vitest-web-config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"vite-plugin-cedar-vitest-web-config.d.ts","sourceRoot":"","sources":["../../../src/web/vitest/vite-plugin-cedar-vitest-web-config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAKlC;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,IAAI,MAAM,CAWnD"}
@@ -1,16 +0,0 @@
1
- import path from "node:path";
2
- function cedarVitestWebConfigPlugin() {
3
- return {
4
- name: "cedar-vitest-web-config",
5
- config: () => {
6
- return {
7
- test: {
8
- setupFiles: [path.join(import.meta.dirname, "vitest-web.setup.js")]
9
- }
10
- };
11
- }
12
- };
13
- }
14
- export {
15
- cedarVitestWebConfigPlugin
16
- };
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=vitest-web.setup.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"vitest-web.setup.d.ts","sourceRoot":"","sources":["../../../src/web/vitest/vitest-web.setup.ts"],"names":[],"mappings":""}
@@ -1,18 +0,0 @@
1
- import { afterAll, afterEach, beforeAll } from "vitest";
2
- import { getPaths } from "@cedarjs/project-config";
3
- import { findCellMocks } from "../findCellMocks.js";
4
- import { closeServer, setupRequestHandlers, startMSW } from "../mockRequests.js";
5
- beforeAll(async () => {
6
- const cellMocks = findCellMocks(getPaths().web.src);
7
- for (const m of cellMocks) {
8
- await import(m);
9
- }
10
- await startMSW("node");
11
- setupRequestHandlers();
12
- });
13
- afterEach(() => {
14
- setupRequestHandlers();
15
- });
16
- afterAll(() => {
17
- closeServer();
18
- });