@cedarjs/testing 7.0.0 → 8.0.0-canary.3265

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 (218) hide show
  1. package/dist/api/mockContext.d.ts +1 -1
  2. package/dist/api/mockContext.d.ts.map +1 -1
  3. package/dist/api/vitest/teardown.d.ts +18 -0
  4. package/dist/api/vitest/teardown.d.ts.map +1 -0
  5. package/dist/api/vitest/teardown.js +43 -0
  6. package/dist/api/vitest/vite-plugin-cedar-vitest-api-config.d.ts.map +1 -1
  7. package/dist/api/vitest/vite-plugin-cedar-vitest-api-config.js +6 -1
  8. package/dist/api/vitest/vitest-api.setup.d.ts.map +1 -1
  9. package/dist/api/vitest/vitest-api.setup.js +9 -22
  10. package/dist/web/MockParamsProvider.d.ts.map +1 -1
  11. package/dist/web/MockParamsProvider.js +10 -1
  12. package/dist/web/MockRouter.d.ts.map +1 -1
  13. package/dist/web/mockRequests.d.ts +14 -0
  14. package/dist/web/mockRequests.d.ts.map +1 -1
  15. package/dist/web/mockRequests.js +8 -0
  16. package/package.json +22 -95
  17. package/config/jest/api/RedwoodApiJestEnv.d.ts +0 -11
  18. package/config/jest/api/RedwoodApiJestEnv.d.ts.map +0 -1
  19. package/config/jest/api/RedwoodApiJestEnv.js +0 -48
  20. package/config/jest/api/apiBabelConfig.d.ts +0 -5
  21. package/config/jest/api/apiBabelConfig.d.ts.map +0 -1
  22. package/config/jest/api/apiBabelConfig.js +0 -34
  23. package/config/jest/api/globalSetup.d.ts +0 -3
  24. package/config/jest/api/globalSetup.d.ts.map +0 -1
  25. package/config/jest/api/globalSetup.js +0 -63
  26. package/config/jest/api/index.d.ts +0 -3
  27. package/config/jest/api/index.d.ts.map +0 -1
  28. package/config/jest/api/index.js +0 -25
  29. package/config/jest/api/jest-preset.d.ts +0 -4
  30. package/config/jest/api/jest-preset.d.ts.map +0 -1
  31. package/config/jest/api/jest-preset.js +0 -140
  32. package/config/jest/api/jest.setup.d.ts +0 -2
  33. package/config/jest/api/jest.setup.d.ts.map +0 -1
  34. package/config/jest/api/jest.setup.js +0 -267
  35. package/config/jest/api/package.json +0 -8
  36. package/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts +0 -11
  37. package/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts.map +0 -1
  38. package/config/jest/babelPlugins/babel-plugin-redwood-cell.js +0 -122
  39. package/config/jest/jest-serial-runner.d.ts +0 -8
  40. package/config/jest/jest-serial-runner.d.ts.map +0 -1
  41. package/config/jest/jest-serial-runner.js +0 -37
  42. package/config/jest/web/RedwoodWebJestEnv.d.ts +0 -6
  43. package/config/jest/web/RedwoodWebJestEnv.d.ts.map +0 -1
  44. package/config/jest/web/RedwoodWebJestEnv.js +0 -43
  45. package/config/jest/web/index.d.ts +0 -3
  46. package/config/jest/web/index.d.ts.map +0 -1
  47. package/config/jest/web/index.js +0 -25
  48. package/config/jest/web/jest-fixed-jsdom.d.js +0 -1
  49. package/config/jest/web/jest-preset.d.ts +0 -4
  50. package/config/jest/web/jest-preset.d.ts.map +0 -1
  51. package/config/jest/web/jest-preset.js +0 -224
  52. package/config/jest/web/jest.setup.d.ts +0 -7
  53. package/config/jest/web/jest.setup.d.ts.map +0 -1
  54. package/config/jest/web/jest.setup.js +0 -21
  55. package/config/jest/web/package.json +0 -8
  56. package/config/jest/web/resolver.d.ts +0 -4
  57. package/config/jest/web/resolver.d.ts.map +0 -1
  58. package/config/jest/web/resolver.js +0 -30
  59. package/config/jest/web/webBabelConfig.d.ts +0 -10
  60. package/config/jest/web/webBabelConfig.d.ts.map +0 -1
  61. package/config/jest/web/webBabelConfig.js +0 -48
  62. package/config/package.json +0 -1
  63. package/dist/cjs/api/apiFunction.d.ts +0 -37
  64. package/dist/cjs/api/apiFunction.d.ts.map +0 -1
  65. package/dist/cjs/api/apiFunction.js +0 -89
  66. package/dist/cjs/api/checkTestDatabase.d.ts +0 -50
  67. package/dist/cjs/api/checkTestDatabase.d.ts.map +0 -1
  68. package/dist/cjs/api/checkTestDatabase.js +0 -182
  69. package/dist/cjs/api/directive.d.ts +0 -51
  70. package/dist/cjs/api/directive.d.ts.map +0 -1
  71. package/dist/cjs/api/directive.js +0 -77
  72. package/dist/cjs/api/index.d.ts +0 -4
  73. package/dist/cjs/api/index.d.ts.map +0 -1
  74. package/dist/cjs/api/index.js +0 -26
  75. package/dist/cjs/api/mockContext.d.ts +0 -5
  76. package/dist/cjs/api/mockContext.d.ts.map +0 -1
  77. package/dist/cjs/api/mockContext.js +0 -58
  78. package/dist/cjs/api/scenario.d.ts +0 -108
  79. package/dist/cjs/api/scenario.d.ts.map +0 -1
  80. package/dist/cjs/api/scenario.js +0 -30
  81. package/dist/cjs/api/vitest/CedarApiVitestEnv.js +0 -86
  82. package/dist/cjs/api/vitest/index.js +0 -34
  83. package/dist/cjs/api/vitest/vite-plugin-auto-import.js +0 -71
  84. package/dist/cjs/api/vitest/vite-plugin-cedar-vitest-api-config.js +0 -69
  85. package/dist/cjs/api/vitest/vite-plugin-track-db-imports.js +0 -47
  86. package/dist/cjs/api/vitest/vitest-api.setup.js +0 -270
  87. package/dist/cjs/cache/index.d.ts +0 -50
  88. package/dist/cjs/cache/index.d.ts.map +0 -1
  89. package/dist/cjs/cache/index.js +0 -104
  90. package/dist/cjs/config/jest/api/RedwoodApiJestEnv.d.ts +0 -11
  91. package/dist/cjs/config/jest/api/RedwoodApiJestEnv.d.ts.map +0 -1
  92. package/dist/cjs/config/jest/api/RedwoodApiJestEnv.js +0 -48
  93. package/dist/cjs/config/jest/api/apiBabelConfig.d.ts +0 -5
  94. package/dist/cjs/config/jest/api/apiBabelConfig.d.ts.map +0 -1
  95. package/dist/cjs/config/jest/api/apiBabelConfig.js +0 -34
  96. package/dist/cjs/config/jest/api/globalSetup.d.ts +0 -3
  97. package/dist/cjs/config/jest/api/globalSetup.d.ts.map +0 -1
  98. package/dist/cjs/config/jest/api/globalSetup.js +0 -63
  99. package/dist/cjs/config/jest/api/index.d.ts +0 -3
  100. package/dist/cjs/config/jest/api/index.d.ts.map +0 -1
  101. package/dist/cjs/config/jest/api/index.js +0 -25
  102. package/dist/cjs/config/jest/api/jest-preset.d.ts +0 -4
  103. package/dist/cjs/config/jest/api/jest-preset.d.ts.map +0 -1
  104. package/dist/cjs/config/jest/api/jest-preset.js +0 -140
  105. package/dist/cjs/config/jest/api/jest.setup.d.ts +0 -2
  106. package/dist/cjs/config/jest/api/jest.setup.d.ts.map +0 -1
  107. package/dist/cjs/config/jest/api/jest.setup.js +0 -267
  108. package/dist/cjs/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts +0 -11
  109. package/dist/cjs/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts.map +0 -1
  110. package/dist/cjs/config/jest/babelPlugins/babel-plugin-redwood-cell.js +0 -122
  111. package/dist/cjs/config/jest/jest-serial-runner.d.ts +0 -8
  112. package/dist/cjs/config/jest/jest-serial-runner.d.ts.map +0 -1
  113. package/dist/cjs/config/jest/jest-serial-runner.js +0 -37
  114. package/dist/cjs/config/jest/web/RedwoodWebJestEnv.d.ts +0 -6
  115. package/dist/cjs/config/jest/web/RedwoodWebJestEnv.d.ts.map +0 -1
  116. package/dist/cjs/config/jest/web/RedwoodWebJestEnv.js +0 -43
  117. package/dist/cjs/config/jest/web/index.d.ts +0 -3
  118. package/dist/cjs/config/jest/web/index.d.ts.map +0 -1
  119. package/dist/cjs/config/jest/web/index.js +0 -25
  120. package/dist/cjs/config/jest/web/jest-fixed-jsdom.d.js +0 -1
  121. package/dist/cjs/config/jest/web/jest-preset.d.ts +0 -4
  122. package/dist/cjs/config/jest/web/jest-preset.d.ts.map +0 -1
  123. package/dist/cjs/config/jest/web/jest-preset.js +0 -224
  124. package/dist/cjs/config/jest/web/jest.setup.d.ts +0 -7
  125. package/dist/cjs/config/jest/web/jest.setup.d.ts.map +0 -1
  126. package/dist/cjs/config/jest/web/jest.setup.js +0 -21
  127. package/dist/cjs/config/jest/web/resolver.d.ts +0 -4
  128. package/dist/cjs/config/jest/web/resolver.d.ts.map +0 -1
  129. package/dist/cjs/config/jest/web/resolver.js +0 -30
  130. package/dist/cjs/config/jest/web/webBabelConfig.d.ts +0 -10
  131. package/dist/cjs/config/jest/web/webBabelConfig.d.ts.map +0 -1
  132. package/dist/cjs/config/jest/web/webBabelConfig.js +0 -48
  133. package/dist/cjs/package.json +0 -1
  134. package/dist/cjs/web/MockParamsProvider.d.ts +0 -7
  135. package/dist/cjs/web/MockParamsProvider.d.ts.map +0 -1
  136. package/dist/cjs/web/MockParamsProvider.js +0 -44
  137. package/dist/cjs/web/MockProviders.d.ts +0 -5
  138. package/dist/cjs/web/MockProviders.d.ts.map +0 -1
  139. package/dist/cjs/web/MockProviders.js +0 -66
  140. package/dist/cjs/web/MockRouter.d.ts +0 -11
  141. package/dist/cjs/web/MockRouter.d.ts.map +0 -1
  142. package/dist/cjs/web/MockRouter.js +0 -48
  143. package/dist/cjs/web/customRender.d.ts +0 -6
  144. package/dist/cjs/web/customRender.d.ts.map +0 -1
  145. package/dist/cjs/web/customRender.js +0 -54
  146. package/dist/cjs/web/fileMock.d.ts +0 -10
  147. package/dist/cjs/web/fileMock.d.ts.map +0 -1
  148. package/dist/cjs/web/fileMock.js +0 -24
  149. package/dist/cjs/web/findCellMocks.d.ts +0 -2
  150. package/dist/cjs/web/findCellMocks.d.ts.map +0 -1
  151. package/dist/cjs/web/findCellMocks.js +0 -45
  152. package/dist/cjs/web/globRoutesImporter.d.ts +0 -13
  153. package/dist/cjs/web/globRoutesImporter.d.ts.map +0 -1
  154. package/dist/cjs/web/globRoutesImporter.js +0 -46
  155. package/dist/cjs/web/global.d.ts +0 -6
  156. package/dist/cjs/web/global.d.ts.map +0 -1
  157. package/dist/cjs/web/global.js +0 -1
  158. package/dist/cjs/web/index.d.ts +0 -6
  159. package/dist/cjs/web/index.d.ts.map +0 -1
  160. package/dist/cjs/web/index.js +0 -41
  161. package/dist/cjs/web/mockAuth.d.ts +0 -29
  162. package/dist/cjs/web/mockAuth.d.ts.map +0 -1
  163. package/dist/cjs/web/mockAuth.js +0 -89
  164. package/dist/cjs/web/mockRequests.d.ts +0 -72
  165. package/dist/cjs/web/mockRequests.d.ts.map +0 -1
  166. package/dist/cjs/web/mockRequests.js +0 -210
  167. package/dist/cjs/web/vitest/index.js +0 -37
  168. package/dist/cjs/web/vitest/vite-plugin-auto-import.js +0 -60
  169. package/dist/cjs/web/vitest/vite-plugin-cedar-vitest-web-config.js +0 -51
  170. package/dist/cjs/web/vitest/vite-plugin-cedarjs-router-import-transform.js +0 -42
  171. package/dist/cjs/web/vitest/vite-plugin-create-auth-import-transform.js +0 -43
  172. package/dist/cjs/web/vitest/vitest-web.setup.js +0 -19
  173. package/dist/config/jest/api/RedwoodApiJestEnv.d.ts +0 -11
  174. package/dist/config/jest/api/RedwoodApiJestEnv.d.ts.map +0 -1
  175. package/dist/config/jest/api/RedwoodApiJestEnv.js +0 -28
  176. package/dist/config/jest/api/apiBabelConfig.d.ts +0 -5
  177. package/dist/config/jest/api/apiBabelConfig.d.ts.map +0 -1
  178. package/dist/config/jest/api/apiBabelConfig.js +0 -18
  179. package/dist/config/jest/api/globalSetup.d.ts +0 -3
  180. package/dist/config/jest/api/globalSetup.d.ts.map +0 -1
  181. package/dist/config/jest/api/globalSetup.js +0 -36
  182. package/dist/config/jest/api/index.d.ts +0 -3
  183. package/dist/config/jest/api/index.d.ts.map +0 -1
  184. package/dist/config/jest/api/index.js +0 -15
  185. package/dist/config/jest/api/jest-preset.d.ts +0 -4
  186. package/dist/config/jest/api/jest-preset.d.ts.map +0 -1
  187. package/dist/config/jest/api/jest-preset.js +0 -110
  188. package/dist/config/jest/api/jest.setup.d.ts +0 -2
  189. package/dist/config/jest/api/jest.setup.d.ts.map +0 -1
  190. package/dist/config/jest/api/jest.setup.js +0 -244
  191. package/dist/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts +0 -11
  192. package/dist/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts.map +0 -1
  193. package/dist/config/jest/babelPlugins/babel-plugin-redwood-cell.js +0 -102
  194. package/dist/config/jest/jest-serial-runner.d.ts +0 -8
  195. package/dist/config/jest/jest-serial-runner.d.ts.map +0 -1
  196. package/dist/config/jest/jest-serial-runner.js +0 -27
  197. package/dist/config/jest/web/RedwoodWebJestEnv.d.ts +0 -6
  198. package/dist/config/jest/web/RedwoodWebJestEnv.d.ts.map +0 -1
  199. package/dist/config/jest/web/RedwoodWebJestEnv.js +0 -13
  200. package/dist/config/jest/web/index.d.ts +0 -3
  201. package/dist/config/jest/web/index.d.ts.map +0 -1
  202. package/dist/config/jest/web/index.js +0 -15
  203. package/dist/config/jest/web/jest-fixed-jsdom.d.js +0 -0
  204. package/dist/config/jest/web/jest-preset.d.ts +0 -4
  205. package/dist/config/jest/web/jest-preset.d.ts.map +0 -1
  206. package/dist/config/jest/web/jest-preset.js +0 -194
  207. package/dist/config/jest/web/jest.setup.d.ts +0 -7
  208. package/dist/config/jest/web/jest.setup.d.ts.map +0 -1
  209. package/dist/config/jest/web/jest.setup.js +0 -27
  210. package/dist/config/jest/web/resolver.d.ts +0 -4
  211. package/dist/config/jest/web/resolver.d.ts.map +0 -1
  212. package/dist/config/jest/web/resolver.js +0 -42
  213. package/dist/config/jest/web/webBabelConfig.d.ts +0 -10
  214. package/dist/config/jest/web/webBabelConfig.d.ts.map +0 -1
  215. package/dist/config/jest/web/webBabelConfig.js +0 -18
  216. package/dist/web/fileMock.d.ts +0 -10
  217. package/dist/web/fileMock.d.ts.map +0 -1
  218. package/dist/web/fileMock.js +0 -4
@@ -1,43 +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 RedwoodWebJestEnv_exports = {};
30
- __export(RedwoodWebJestEnv_exports, {
31
- default: () => RedwoodWebJestEnv_default
32
- });
33
- module.exports = __toCommonJS(RedwoodWebJestEnv_exports);
34
- var import_jest_fixed_jsdom = __toESM(require("jest-fixed-jsdom"), 1);
35
- class RedwoodWebJestEnvironment extends import_jest_fixed_jsdom.default {
36
- async setup() {
37
- await super.setup();
38
- if (typeof this.global.crypto.subtle === "undefined") {
39
- this.global.crypto.subtle = {};
40
- }
41
- }
42
- }
43
- var RedwoodWebJestEnv_default = RedwoodWebJestEnvironment;
@@ -1,3 +0,0 @@
1
- import * as jestPreset from './jest-preset.js';
2
- export = jestPreset;
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/config/jest/web/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAA;AAM9C,SAAS,UAAU,CAAA"}
@@ -1,25 +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 __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (let key of __getOwnPropNames(from))
11
- if (!__hasOwnProp.call(to, key) && key !== except)
12
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- }
14
- return to;
15
- };
16
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
- // If the importer is in node compatibility mode or this is not an ESM
18
- // file that has been converted to a CommonJS file using a Babel-
19
- // compatible transform (i.e. "__esModule" has not been set), then set
20
- // "default" to the CommonJS "module.exports" for node compatibility.
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
- mod
23
- ));
24
- var jestPreset = __toESM(require("./jest-preset.js"), 1);
25
- module.exports = jestPreset;
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,4 +0,0 @@
1
- import type { Config } from 'jest';
2
- declare const config: Config;
3
- export default config;
4
- //# sourceMappingURL=jest-preset.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jest-preset.d.ts","sourceRoot":"","sources":["../../../../../src/config/jest/web/jest-preset.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAiIlC,QAAA,MAAM,MAAM,EAAE,MA0Ib,CAAA;AAED,eAAe,MAAM,CAAA"}
@@ -1,224 +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 jest_preset_exports = {};
30
- __export(jest_preset_exports, {
31
- default: () => jest_preset_default
32
- });
33
- module.exports = __toCommonJS(jest_preset_exports);
34
- var import_node_fs = __toESM(require("node:fs"), 1);
35
- var import_node_path = __toESM(require("node:path"), 1);
36
- var import_project_config = require("@cedarjs/project-config");
37
- const cedarPaths = (0, import_project_config.getPaths)();
38
- const RESOLVE_FROM = [cedarPaths.web.base, cedarPaths.base];
39
- function resolvePackageDir(packageName, resolveFrom = RESOLVE_FROM) {
40
- try {
41
- return import_node_path.default.dirname(
42
- require.resolve(`${packageName}/package.json`, { paths: resolveFrom })
43
- );
44
- } catch {
45
- }
46
- try {
47
- let dir = import_node_path.default.dirname(require.resolve(packageName, { paths: resolveFrom }));
48
- for (; ; ) {
49
- const manifestPath = import_node_path.default.join(dir, "package.json");
50
- if (import_node_fs.default.existsSync(manifestPath)) {
51
- const manifest = JSON.parse(
52
- import_node_fs.default.readFileSync(manifestPath, "utf-8")
53
- );
54
- if (manifest && typeof manifest === "object" && "name" in manifest && manifest.name === packageName) {
55
- return dir;
56
- }
57
- }
58
- const parent = import_node_path.default.dirname(dir);
59
- if (parent === dir) {
60
- return void 0;
61
- }
62
- dir = parent;
63
- }
64
- } catch {
65
- return void 0;
66
- }
67
- }
68
- function packagePath(packageName, relativePath = "", resolveFrom = RESOLVE_FROM) {
69
- const packageDir = resolvePackageDir(packageName, resolveFrom);
70
- return packageDir && import_node_path.default.join(packageDir, relativePath);
71
- }
72
- function resolveSubpath(specifier, resolveFrom = RESOLVE_FROM) {
73
- try {
74
- return require.resolve(specifier, { paths: resolveFrom });
75
- } catch {
76
- return void 0;
77
- }
78
- }
79
- const cedarWebDir = resolvePackageDir("@cedarjs/web");
80
- const cedarWebResolveFrom = cedarWebDir ? [cedarWebDir, ...RESOLVE_FROM] : RESOLVE_FROM;
81
- function definedEntries(mappings) {
82
- return Object.fromEntries(
83
- Object.entries(mappings).filter(
84
- (entry) => entry[1] !== void 0
85
- )
86
- );
87
- }
88
- const config = {
89
- // To make sure other config option which depends on rootDir always
90
- // use correct path, for example, coverageDirectory
91
- rootDir: cedarPaths.base,
92
- roots: [import_node_path.default.join(cedarPaths.web.src)],
93
- // Opting out of jsdom's browser-style export condition resolution (needed to
94
- // resolve `msw/node`) is handled by the environment itself, via
95
- // jest-fixed-jsdom
96
- testEnvironment: import_node_path.default.join(__dirname, "./RedwoodWebJestEnv.js"),
97
- displayName: {
98
- color: "blueBright",
99
- name: "web"
100
- },
101
- globals: {
102
- __RWJS_TESTROOT_DIR: import_node_path.default.join(cedarPaths.web.src),
103
- // used in jest setup to load mocks
104
- RWJS_ENV: {
105
- RWJS_API_URL: "",
106
- RWJS_API_GRAPHQL_URL: "/",
107
- __REDWOOD__APP_TITLE: "Redwood App"
108
- },
109
- RWJS_DEBUG_ENV: {
110
- RWJS_SRC_ROOT: cedarPaths.web.src
111
- }
112
- },
113
- collectCoverageFrom: [
114
- "**/*.{js,jsx,ts,tsx}",
115
- "!**/node_modules/**",
116
- "!**/dist/**"
117
- ],
118
- coverageDirectory: import_node_path.default.join(cedarPaths.base, "coverage"),
119
- watchPlugins: [
120
- "jest-watch-typeahead/filename",
121
- "jest-watch-typeahead/testname"
122
- ],
123
- setupFilesAfterEnv: [import_node_path.default.resolve(__dirname, "./jest.setup.js")],
124
- moduleNameMapper: {
125
- ...definedEntries({
126
- /**
127
- * Make sure modules that require different versions of these
128
- * dependencies end up using the same one.
129
- */
130
- "^react$": resolveSubpath("react"),
131
- "^react-dom$": resolveSubpath("react-dom"),
132
- // Point straight at Apollo Client's CJS build. Resolving the subpath
133
- // would go through its `exports` map and land on the ESM build (Node 22+
134
- // picks the `module-sync` condition), which Jest can't parse.
135
- // Resolved starting from `@cedarjs/web` because that's what depends on
136
- // Apollo — a project doesn't declare it itself, so under pnpm it isn't
137
- // reachable from the web side at all, and searching from there finds
138
- // either nothing or some unrelated copy pulled in by another dependency
139
- "^@apollo/client/react$": packagePath(
140
- "@apollo/client",
141
- "__cjs/react/index.cjs",
142
- cedarWebResolveFrom
143
- ),
144
- // We replace imports to "@cedarjs/router" with our own "mock" implementation.
145
- "^@cedarjs/router$": resolveSubpath("@cedarjs/testing/web/MockRouter.js"),
146
- "^@cedarjs/web$": resolveSubpath("@cedarjs/web"),
147
- // This allows us to mock `createAuthentication` which is used by auth
148
- // clients, which in turn lets us mock `useAuth` in tests
149
- "^@cedarjs/auth$": resolveSubpath("@cedarjs/testing/auth"),
150
- // @NOTE: Import @cedarjs/testing in web tests, and it automatically remaps to the web side only
151
- // This is to prevent web stuff leaking into api, and vice versa
152
- "^@cedarjs/testing$": resolveSubpath("@cedarjs/testing/web"),
153
- /**
154
- * Mock out files that aren't particularly useful in tests. See fileMock.js for more info.
155
- */
156
- "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|css)$": resolveSubpath("@cedarjs/testing/dist/cjs/web/fileMock.js")
157
- }),
158
- "~__CEDAR__USER_ROUTES_FOR_MOCK": cedarPaths.web.routes,
159
- "~__CEDAR__USER_AUTH_FOR_MOCK": import_node_path.default.join(cedarPaths.web.src, "auth"),
160
- // Support for importing files with extensions (like you'd do in ESM projects)
161
- "^(\\.{1,2}/.*)\\.js$": "$1"
162
- },
163
- transform: {
164
- // MSW's CommonJS build `require`s ESM-only packages (`rettime`,
165
- // `@open-draft/deferred-promise` and `until-async`, which ships ESM in
166
- // plain `.js` files). Node supports require(esm), but Jest's runtime
167
- // doesn't, so compile any `.mjs` file that gets pulled in from
168
- // node_modules (plus until-async) to CommonJS. This needs its own
169
- // transform entry (with the config inlined) because the web babel config
170
- // ignores node_modules
171
- //
172
- // The `@cedarjs/auth-*-web` packages are ESM-only too, and (like
173
- // until-async) ship plain `.js` files rather than `.mjs` since their
174
- // package.json already declares `"type": "module"`. A generated
175
- // project's `web/src/auth.ts` imports one of these, so they need the
176
- // same carve-out. `@cedarjs/forms` is ESM-only for the same reason, and
177
- // gets pulled into virtually every generated project's web-side tests
178
- // via `web/src/pages/**` scaffolds and dbAuth login/signup forms.
179
- // `@cedarjs/web`, `@cedarjs/auth`, and `@cedarjs/router` are ESM-only
180
- // too. `web` and `router` are imported directly by virtually every
181
- // generated project's web-side test (`Routes.tsx`, page/component
182
- // scaffolds), and `auth` gets pulled in transitively through `web`.
183
- // Jest's own module loader re-applies this carve-out to every file it
184
- // loads, including ones reached transitively through an
185
- // already-transformed require() call, so all of them need to be listed
186
- // even though only `web`/`router` are usually imported directly.
187
- "[/\\\\]node_modules[/\\\\](?:.+\\.mjs|(?:until-async|@cedarjs[/\\\\](?:auth-[a-z-]+-web|forms|web|auth|router))[/\\\\].+\\.js)$": [
188
- "babel-jest",
189
- {
190
- babelrc: false,
191
- configFile: false,
192
- presets: [
193
- [require.resolve("@babel/preset-env"), { targets: { node: "20" } }]
194
- ]
195
- }
196
- ],
197
- "\\.[jt]sx?$": [
198
- "babel-jest",
199
- // When jest runs tests in parallel, it serializes the config before passing down options to babel
200
- // that's why these must be serializable. Passing the reference to a config instead.
201
- {
202
- configFile: import_node_path.default.resolve(__dirname, "./webBabelConfig.js")
203
- }
204
- ]
205
- },
206
- // Jest's default is to not transform anything in node_modules, but `.mjs`
207
- // files (and until-async, @cedarjs/auth-*-web, @cedarjs/forms,
208
- // @cedarjs/web, @cedarjs/auth, and @cedarjs/router) have to be compiled to
209
- // CommonJS (see the transform above).
210
- // The `.pnpm` lookahead is what makes this work with pnpm: its virtual store
211
- // puts packages at `node_modules/.pnpm/<pkg>@<version>/node_modules/<pkg>`,
212
- // so without it the pattern matches (and thereby ignores) at the *first*
213
- // `node_modules` segment, where the following path starts with `.pnpm/`
214
- // instead of `until-async/` and the exception never gets a chance to apply.
215
- // Skipping that segment forces the match onto the inner `node_modules`,
216
- // which looks the same as a hoisted npm/yarn layout
217
- transformIgnorePatterns: [
218
- "[/\\\\]node_modules[/\\\\](?!\\.pnpm[/\\\\])(?!.*\\.mjs$)(?!until-async[/\\\\])(?!@cedarjs[/\\\\]auth-[a-z-]+-web[/\\\\])(?!@cedarjs[/\\\\]forms[/\\\\])(?!@cedarjs[/\\\\]web[/\\\\])(?!@cedarjs[/\\\\]auth[/\\\\])(?!@cedarjs[/\\\\]router[/\\\\])",
219
- "\\.pnp\\.[^\\\\/]+$"
220
- ],
221
- resolver: import_node_path.default.resolve(__dirname, "./resolver.js"),
222
- testPathIgnorePatterns: [".(stories|mock).[jt]sx?$"]
223
- };
224
- var jest_preset_default = config;
@@ -1,7 +0,0 @@
1
- import '@testing-library/jest-dom';
2
- import { mockCurrentUser as _mockCurrentUser } from '../../../web/mockRequests.js';
3
- declare global {
4
- var __RWJS_TESTROOT_DIR: string;
5
- var mockCurrentUser: typeof _mockCurrentUser;
6
- }
7
- //# sourceMappingURL=jest.setup.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jest.setup.d.ts","sourceRoot":"","sources":["../../../../../src/config/jest/web/jest.setup.ts"],"names":[],"mappings":"AAEA,OAAO,2BAA2B,CAAA;AAGlC,OAAO,EAML,eAAe,IAAI,gBAAgB,EACpC,MAAM,8BAA8B,CAAA;AAErC,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,mBAAmB,EAAE,MAAM,CAAA;IAE/B,IAAI,eAAe,EAAE,OAAO,gBAAgB,CAAA;CAC7C"}
@@ -1,21 +0,0 @@
1
- "use strict";
2
- var import_jest_dom = require("@testing-library/jest-dom");
3
- var import_findCellMocks = require("@cedarjs/testing/dist/cjs/web/findCellMocks.js");
4
- var import_mockRequests = require("@cedarjs/testing/dist/cjs/web/mockRequests.js");
5
- global.mockGraphQLQuery = import_mockRequests.mockGraphQLQuery;
6
- global.mockGraphQLMutation = import_mockRequests.mockGraphQLMutation;
7
- global.mockCurrentUser = import_mockRequests.mockCurrentUser;
8
- const cellMocks = (0, import_findCellMocks.findCellMocks)(global.__RWJS_TESTROOT_DIR);
9
- beforeAll(async () => {
10
- for (const m of cellMocks) {
11
- require(m);
12
- }
13
- await (0, import_mockRequests.startMSW)("node");
14
- (0, import_mockRequests.setupRequestHandlers)();
15
- });
16
- afterEach(() => {
17
- (0, import_mockRequests.setupRequestHandlers)();
18
- });
19
- afterAll(() => {
20
- (0, import_mockRequests.closeServer)();
21
- });
@@ -1,8 +0,0 @@
1
- {
2
- "name": "cedarjs-jest-web-preset",
3
- "version": "0.0.1",
4
- "type": "commonjs",
5
- "main": "index.js",
6
- "license": "MIT",
7
- "types": "./index.d.ts"
8
- }
@@ -1,4 +0,0 @@
1
- import type { ResolverOptions } from 'jest-resolve';
2
- declare function resolver(path: string, options: ResolverOptions): string;
3
- export = resolver;
4
- //# sourceMappingURL=resolver.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../../../../src/config/jest/web/resolver.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAEnD,iBAAS,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,UAYvD;AAMD,SAAS,QAAQ,CAAA"}
@@ -1,30 +0,0 @@
1
- "use strict";
2
- function resolver(path, options) {
3
- return options.defaultResolver(path, {
4
- ...options,
5
- packageFilter: (pkg) => {
6
- if (OVERRIDE_EXPORTS_LIST.has(pkg.name)) {
7
- delete pkg["exports"];
8
- delete pkg["module"];
9
- }
10
- return pkg;
11
- }
12
- });
13
- }
14
- const OVERRIDE_EXPORTS_LIST = /* @__PURE__ */ new Set([
15
- "@firebase/analytics",
16
- "@firebase/app",
17
- "@firebase/app-check",
18
- "@firebase/auth",
19
- "@firebase/database",
20
- "@firebase/firestore",
21
- "@firebase/functions",
22
- "@firebase/installations",
23
- "@firebase/messaging",
24
- "@firebase/performance",
25
- "@firebase/remote-config",
26
- "@firebase/storage",
27
- "@firebase/util",
28
- "firebase"
29
- ]);
30
- module.exports = resolver;
@@ -1,10 +0,0 @@
1
- declare const _default: {
2
- overrides: import("@babel/core").TransformOptions[];
3
- presets: ((string | undefined)[] | (string | object)[])[];
4
- plugins: import("@babel/core").TransformOptions[];
5
- extends: string | undefined;
6
- babelrc: boolean;
7
- ignore: string[];
8
- };
9
- export default _default;
10
- //# sourceMappingURL=webBabelConfig.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"webBabelConfig.d.ts","sourceRoot":"","sources":["../../../../../src/config/jest/web/webBabelConfig.ts"],"names":[],"mappings":";;;;;;;;AAQA,wBASC"}
@@ -1,48 +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 webBabelConfig_exports = {};
30
- __export(webBabelConfig_exports, {
31
- default: () => webBabelConfig_default
32
- });
33
- module.exports = __toCommonJS(webBabelConfig_exports);
34
- var import_babel_config = require("@cedarjs/babel-config");
35
- var import_babel_plugin_redwood_cell = __toESM(require("../babelPlugins/babel-plugin-redwood-cell.js"), 1);
36
- const defaultWebSideBabelConfig = (0, import_babel_config.getWebSideDefaultBabelConfig)({
37
- forJest: true
38
- });
39
- var webBabelConfig_default = {
40
- ...defaultWebSideBabelConfig,
41
- overrides: [
42
- ...defaultWebSideBabelConfig.overrides,
43
- {
44
- test: /.+Cell.(js|tsx|jsx)$/,
45
- plugins: [import_babel_plugin_redwood_cell.default]
46
- }
47
- ]
48
- };
@@ -1 +0,0 @@
1
- {"type":"commonjs"}
@@ -1,37 +0,0 @@
1
- import type { APIGatewayProxyEvent, APIGatewayProxyEventHeaders, Context } from 'aws-lambda';
2
- import type { SupportedVerifierTypes } from '@cedarjs/api/webhooks';
3
- interface BuildEventParams extends Partial<APIGatewayProxyEvent> {
4
- payload?: string | null | Record<any, any>;
5
- signature?: string;
6
- signatureHeader?: string;
7
- headers?: APIGatewayProxyEventHeaders;
8
- }
9
- /**
10
- * @description Use this to mock out the http request event that is received by your function in unit tests
11
- *
12
- * @example Mocking sending headers
13
- * mockHttpEvent({header: {'X-Custom-Header': 'bazinga'}})
14
- *
15
- * @example Adding a JSON payload
16
- * mockHttpEvent({payload: JSON.stringify(mockedRequestBody)})
17
- *
18
- * @returns APIGatewayProxyEvent
19
- */
20
- export declare const mockHttpEvent: ({ payload, signature, signatureHeader, queryStringParameters, httpMethod, headers, path, isBase64Encoded, ...others }: BuildEventParams) => APIGatewayProxyEvent;
21
- /**
22
- * @description Use this function to mock the http event's context
23
- * @see: https://docs.aws.amazon.com/lambda/latest/dg/nodejs-context.html
24
- **/
25
- export declare const mockContext: () => Context;
26
- interface MockedSignedWebhookParams extends Omit<BuildEventParams, 'signature' | 'signatureHeader'> {
27
- signatureType: Exclude<SupportedVerifierTypes, 'skipVerifier'>;
28
- signatureHeader: string;
29
- secret: string;
30
- }
31
- /**
32
- * @description Use this function to mock a signed webhook
33
- * @see https://cedarjs.com/docs/webhooks#webhooks
34
- **/
35
- export declare const mockSignedWebhook: ({ payload, signatureType, signatureHeader, secret, ...others }: MockedSignedWebhookParams) => APIGatewayProxyEvent;
36
- export {};
37
- //# sourceMappingURL=apiFunction.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"apiFunction.d.ts","sourceRoot":"","sources":["../../../src/api/apiFunction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,2BAA2B,EAC3B,OAAO,EACR,MAAM,YAAY,CAAA;AAEnB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAGnE,UAAU,gBAAiB,SAAQ,OAAO,CAAC,oBAAoB,CAAC;IAC9D,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,OAAO,CAAC,EAAE,2BAA2B,CAAA;CACtC;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,aAAa,GAAI,uHAU3B,gBAAgB,KAAG,oBAgCrB,CAAA;AAED;;;IAGI;AACJ,eAAO,MAAM,WAAW,QAAO,OAI9B,CAAA;AAED,UAAU,yBAA0B,SAAQ,IAAI,CAC9C,gBAAgB,EAChB,WAAW,GAAG,iBAAiB,CAChC;IACC,aAAa,EAAE,OAAO,CAAC,sBAAsB,EAAE,cAAc,CAAC,CAAA;IAC9D,eAAe,EAAE,MAAM,CAAA;IACvB,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;IAGI;AACJ,eAAO,MAAM,iBAAiB,GAAI,gEAM/B,yBAAyB,yBAe3B,CAAA"}
@@ -1,89 +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 apiFunction_exports = {};
20
- __export(apiFunction_exports, {
21
- mockContext: () => mockContext,
22
- mockHttpEvent: () => mockHttpEvent,
23
- mockSignedWebhook: () => mockSignedWebhook
24
- });
25
- module.exports = __toCommonJS(apiFunction_exports);
26
- var import_webhooks = require("@cedarjs/api/webhooks");
27
- const mockHttpEvent = ({
28
- payload = null,
29
- signature,
30
- signatureHeader,
31
- queryStringParameters = null,
32
- httpMethod = "GET",
33
- headers = {},
34
- path = "",
35
- isBase64Encoded = false,
36
- ...others
37
- }) => {
38
- if (signature && signatureHeader) {
39
- headers[signatureHeader.toLocaleLowerCase()] = signature;
40
- }
41
- const payloadAsString = typeof payload === "string" ? payload : JSON.stringify(payload);
42
- const body = payload === null ? null : isBase64Encoded ? Buffer.from(payloadAsString || "").toString("base64") : payloadAsString;
43
- return {
44
- body,
45
- headers,
46
- multiValueHeaders: {},
47
- isBase64Encoded,
48
- path,
49
- pathParameters: null,
50
- stageVariables: null,
51
- httpMethod,
52
- queryStringParameters,
53
- // @ts-expect-error not required for mocks
54
- requestContext: null,
55
- // @ts-expect-error not required for mocks
56
- resource: null,
57
- multiValueQueryStringParameters: null,
58
- ...others
59
- };
60
- };
61
- const mockContext = () => {
62
- const context = {};
63
- return context;
64
- };
65
- const mockSignedWebhook = ({
66
- payload = null,
67
- signatureType,
68
- signatureHeader,
69
- secret,
70
- ...others
71
- }) => {
72
- const payloadAsString = typeof payload === "string" ? payload : JSON.stringify(payload);
73
- const signature = (0, import_webhooks.signPayload)(signatureType, {
74
- payload: payloadAsString,
75
- secret
76
- });
77
- return mockHttpEvent({
78
- payload,
79
- signature,
80
- signatureHeader,
81
- ...others
82
- });
83
- };
84
- // Annotate the CommonJS export names for ESM import in node:
85
- 0 && (module.exports = {
86
- mockContext,
87
- mockHttpEvent,
88
- mockSignedWebhook
89
- });
@@ -1,50 +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
- /**
24
- * Guards `cedar test api`'s destructive database reset by *identity*, not
25
- * just provider: refuses to run when the resolved test database is the same
26
- * database as `DATABASE_URL` — same host, port, and database name, or the
27
- * same sqlite file.
28
- *
29
- * This is deliberately the only check, rather than also requiring the
30
- * database's *name* to look test-like (e.g. containing "test" or "e2e"). A
31
- * naming convention doesn't hold for managed Postgres providers with a
32
- * fixed default database name shared by every project — every Supabase
33
- * project's database is named `postgres`, for instance — so it can't tell a
34
- * real project's database apart from a dedicated test one by name alone.
35
- * Whether the two connection strings resolve to the same database is the
36
- * one fact that holds across every provider.
37
- *
38
- * When there's no `DATABASE_URL` at all to compare against, this fails
39
- * closed rather than skipping the check: an explicit `TEST_DATABASE_URL`
40
- * with nothing to confirm it's not the app's real database is refused,
41
- * since there'd be no way to tell it apart from one that is. Cedar's own
42
- * generated sqlite fallback (`usedFallback`) is exempt from that fail-closed
43
- * refusal — it's a path only Cedar controls, so there's no need to force a
44
- * `DATABASE_URL` to exist just to permit it — but it still runs through the
45
- * same-database comparison below whenever a `DATABASE_URL` is present, so a
46
- * project whose real database happens to live at that same generated path
47
- * is still caught.
48
- */
49
- export declare function checkTestDatabaseIdentity(testDatabaseUrl: string, mainDatabaseUrl: string | undefined, usedFallback: boolean): void;
50
- //# sourceMappingURL=checkTestDatabase.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"checkTestDatabase.d.ts","sourceRoot":"","sources":["../../../src/api/checkTestDatabase.ts"],"names":[],"mappings":"AAoBA;;;;;;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;AAuHD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,yBAAyB,CACvC,eAAe,EAAE,MAAM,EACvB,eAAe,EAAE,MAAM,GAAG,SAAS,EACnC,YAAY,EAAE,OAAO,QAkCtB"}