@cedarjs/testing 9.0.0-canary.1784 → 9.0.0-canary.3124

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 (244) hide show
  1. package/dist/api/checkTestDatabase.d.ts +23 -0
  2. package/dist/api/checkTestDatabase.d.ts.map +1 -0
  3. package/dist/api/checkTestDatabase.js +44 -0
  4. package/dist/api/index.d.ts +0 -1
  5. package/dist/api/index.d.ts.map +1 -1
  6. package/dist/api/index.js +0 -1
  7. package/dist/api/vitest/CedarApiVitestEnv.d.ts.map +1 -1
  8. package/dist/api/vitest/CedarApiVitestEnv.js +22 -17
  9. package/dist/api/vitest/teardown.d.ts +18 -0
  10. package/dist/api/vitest/teardown.d.ts.map +1 -0
  11. package/dist/api/vitest/teardown.js +43 -0
  12. package/dist/api/vitest/vite-plugin-cedar-vitest-api-config.d.ts.map +1 -1
  13. package/dist/api/vitest/vite-plugin-cedar-vitest-api-config.js +13 -8
  14. package/dist/api/vitest/vitest-api.setup.d.ts.map +1 -1
  15. package/dist/api/vitest/vitest-api.setup.js +18 -33
  16. package/dist/cache/index.js +1 -1
  17. package/dist/web/MockParamsProvider.d.ts.map +1 -1
  18. package/dist/web/MockParamsProvider.js +10 -1
  19. package/dist/web/MockProviders.js +12 -6
  20. package/dist/web/MockRouter.d.ts.map +1 -1
  21. package/dist/web/mockRequests.d.ts +74 -18
  22. package/dist/web/mockRequests.d.ts.map +1 -1
  23. package/dist/web/mockRequests.js +118 -39
  24. package/dist/web/vitest/index.d.ts +1 -0
  25. package/dist/web/vitest/index.d.ts.map +1 -1
  26. package/dist/web/vitest/index.js +2 -0
  27. package/dist/web/vitest/vite-plugin-cedar-vitest-web-config.d.ts +12 -0
  28. package/dist/web/vitest/vite-plugin-cedar-vitest-web-config.d.ts.map +1 -0
  29. package/dist/web/vitest/vite-plugin-cedar-vitest-web-config.js +16 -0
  30. package/dist/web/vitest/vite-plugin-cedarjs-router-import-transform.d.ts.map +1 -1
  31. package/dist/web/vitest/vite-plugin-create-auth-import-transform.d.ts.map +1 -1
  32. package/dist/web/vitest/vitest-web.setup.d.ts +2 -0
  33. package/dist/web/vitest/vitest-web.setup.d.ts.map +1 -0
  34. package/dist/web/vitest/vitest-web.setup.js +18 -0
  35. package/package.json +41 -106
  36. package/LICENSE +0 -21
  37. package/config/jest/api/RedwoodApiJestEnv.d.ts +0 -11
  38. package/config/jest/api/RedwoodApiJestEnv.d.ts.map +0 -1
  39. package/config/jest/api/RedwoodApiJestEnv.js +0 -48
  40. package/config/jest/api/apiBabelConfig.d.ts +0 -5
  41. package/config/jest/api/apiBabelConfig.d.ts.map +0 -1
  42. package/config/jest/api/apiBabelConfig.js +0 -34
  43. package/config/jest/api/globalSetup.d.ts +0 -3
  44. package/config/jest/api/globalSetup.d.ts.map +0 -1
  45. package/config/jest/api/globalSetup.js +0 -63
  46. package/config/jest/api/index.d.ts +0 -3
  47. package/config/jest/api/index.d.ts.map +0 -1
  48. package/config/jest/api/index.js +0 -25
  49. package/config/jest/api/jest-preset.d.ts +0 -4
  50. package/config/jest/api/jest-preset.d.ts.map +0 -1
  51. package/config/jest/api/jest-preset.js +0 -99
  52. package/config/jest/api/jest.setup.d.ts +0 -2
  53. package/config/jest/api/jest.setup.d.ts.map +0 -1
  54. package/config/jest/api/jest.setup.js +0 -271
  55. package/config/jest/api/package.json +0 -8
  56. package/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts +0 -11
  57. package/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts.map +0 -1
  58. package/config/jest/babelPlugins/babel-plugin-redwood-cell.js +0 -121
  59. package/config/jest/jest-serial-runner.d.ts +0 -8
  60. package/config/jest/jest-serial-runner.d.ts.map +0 -1
  61. package/config/jest/jest-serial-runner.js +0 -37
  62. package/config/jest/web/RedwoodWebJestEnv.d.ts +0 -6
  63. package/config/jest/web/RedwoodWebJestEnv.d.ts.map +0 -1
  64. package/config/jest/web/RedwoodWebJestEnv.js +0 -38
  65. package/config/jest/web/index.d.ts +0 -3
  66. package/config/jest/web/index.d.ts.map +0 -1
  67. package/config/jest/web/index.js +0 -25
  68. package/config/jest/web/jest-preset.d.ts +0 -4
  69. package/config/jest/web/jest-preset.d.ts.map +0 -1
  70. package/config/jest/web/jest-preset.js +0 -119
  71. package/config/jest/web/jest.setup.d.ts +0 -8
  72. package/config/jest/web/jest.setup.d.ts.map +0 -1
  73. package/config/jest/web/jest.setup.js +0 -22
  74. package/config/jest/web/package.json +0 -8
  75. package/config/jest/web/resolver.d.ts +0 -4
  76. package/config/jest/web/resolver.d.ts.map +0 -1
  77. package/config/jest/web/resolver.js +0 -30
  78. package/config/jest/web/webBabelConfig.d.ts +0 -10
  79. package/config/jest/web/webBabelConfig.d.ts.map +0 -1
  80. package/config/jest/web/webBabelConfig.js +0 -48
  81. package/config/package.json +0 -1
  82. package/dist/api/directUrlHelpers.d.ts +0 -3
  83. package/dist/api/directUrlHelpers.d.ts.map +0 -1
  84. package/dist/api/directUrlHelpers.js +0 -25
  85. package/dist/cjs/api/apiFunction.d.ts +0 -37
  86. package/dist/cjs/api/apiFunction.d.ts.map +0 -1
  87. package/dist/cjs/api/apiFunction.js +0 -89
  88. package/dist/cjs/api/directUrlHelpers.d.ts +0 -3
  89. package/dist/cjs/api/directUrlHelpers.d.ts.map +0 -1
  90. package/dist/cjs/api/directUrlHelpers.js +0 -60
  91. package/dist/cjs/api/directive.d.ts +0 -51
  92. package/dist/cjs/api/directive.d.ts.map +0 -1
  93. package/dist/cjs/api/directive.js +0 -77
  94. package/dist/cjs/api/index.d.ts +0 -5
  95. package/dist/cjs/api/index.d.ts.map +0 -1
  96. package/dist/cjs/api/index.js +0 -28
  97. package/dist/cjs/api/mockContext.d.ts +0 -5
  98. package/dist/cjs/api/mockContext.d.ts.map +0 -1
  99. package/dist/cjs/api/mockContext.js +0 -58
  100. package/dist/cjs/api/scenario.d.ts +0 -108
  101. package/dist/cjs/api/scenario.d.ts.map +0 -1
  102. package/dist/cjs/api/scenario.js +0 -30
  103. package/dist/cjs/api/vitest/CedarApiVitestEnv.js +0 -73
  104. package/dist/cjs/api/vitest/index.js +0 -34
  105. package/dist/cjs/api/vitest/vite-plugin-auto-import.js +0 -71
  106. package/dist/cjs/api/vitest/vite-plugin-cedar-vitest-api-config.js +0 -69
  107. package/dist/cjs/api/vitest/vite-plugin-track-db-imports.js +0 -47
  108. package/dist/cjs/api/vitest/vitest-api.setup.js +0 -272
  109. package/dist/cjs/cache/index.d.ts +0 -50
  110. package/dist/cjs/cache/index.d.ts.map +0 -1
  111. package/dist/cjs/cache/index.js +0 -104
  112. package/dist/cjs/config/jest/api/RedwoodApiJestEnv.d.ts +0 -11
  113. package/dist/cjs/config/jest/api/RedwoodApiJestEnv.d.ts.map +0 -1
  114. package/dist/cjs/config/jest/api/RedwoodApiJestEnv.js +0 -48
  115. package/dist/cjs/config/jest/api/apiBabelConfig.d.ts +0 -5
  116. package/dist/cjs/config/jest/api/apiBabelConfig.d.ts.map +0 -1
  117. package/dist/cjs/config/jest/api/apiBabelConfig.js +0 -34
  118. package/dist/cjs/config/jest/api/globalSetup.d.ts +0 -3
  119. package/dist/cjs/config/jest/api/globalSetup.d.ts.map +0 -1
  120. package/dist/cjs/config/jest/api/globalSetup.js +0 -63
  121. package/dist/cjs/config/jest/api/index.d.ts +0 -3
  122. package/dist/cjs/config/jest/api/index.d.ts.map +0 -1
  123. package/dist/cjs/config/jest/api/index.js +0 -25
  124. package/dist/cjs/config/jest/api/jest-preset.d.ts +0 -4
  125. package/dist/cjs/config/jest/api/jest-preset.d.ts.map +0 -1
  126. package/dist/cjs/config/jest/api/jest-preset.js +0 -99
  127. package/dist/cjs/config/jest/api/jest.setup.d.ts +0 -2
  128. package/dist/cjs/config/jest/api/jest.setup.d.ts.map +0 -1
  129. package/dist/cjs/config/jest/api/jest.setup.js +0 -271
  130. package/dist/cjs/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts +0 -11
  131. package/dist/cjs/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts.map +0 -1
  132. package/dist/cjs/config/jest/babelPlugins/babel-plugin-redwood-cell.js +0 -121
  133. package/dist/cjs/config/jest/jest-serial-runner.d.ts +0 -8
  134. package/dist/cjs/config/jest/jest-serial-runner.d.ts.map +0 -1
  135. package/dist/cjs/config/jest/jest-serial-runner.js +0 -37
  136. package/dist/cjs/config/jest/web/RedwoodWebJestEnv.d.ts +0 -6
  137. package/dist/cjs/config/jest/web/RedwoodWebJestEnv.d.ts.map +0 -1
  138. package/dist/cjs/config/jest/web/RedwoodWebJestEnv.js +0 -38
  139. package/dist/cjs/config/jest/web/index.d.ts +0 -3
  140. package/dist/cjs/config/jest/web/index.d.ts.map +0 -1
  141. package/dist/cjs/config/jest/web/index.js +0 -25
  142. package/dist/cjs/config/jest/web/jest-preset.d.ts +0 -4
  143. package/dist/cjs/config/jest/web/jest-preset.d.ts.map +0 -1
  144. package/dist/cjs/config/jest/web/jest-preset.js +0 -119
  145. package/dist/cjs/config/jest/web/jest.setup.d.ts +0 -8
  146. package/dist/cjs/config/jest/web/jest.setup.d.ts.map +0 -1
  147. package/dist/cjs/config/jest/web/jest.setup.js +0 -22
  148. package/dist/cjs/config/jest/web/resolver.d.ts +0 -4
  149. package/dist/cjs/config/jest/web/resolver.d.ts.map +0 -1
  150. package/dist/cjs/config/jest/web/resolver.js +0 -30
  151. package/dist/cjs/config/jest/web/webBabelConfig.d.ts +0 -10
  152. package/dist/cjs/config/jest/web/webBabelConfig.d.ts.map +0 -1
  153. package/dist/cjs/config/jest/web/webBabelConfig.js +0 -48
  154. package/dist/cjs/package.json +0 -1
  155. package/dist/cjs/web/MockParamsProvider.d.ts +0 -7
  156. package/dist/cjs/web/MockParamsProvider.d.ts.map +0 -1
  157. package/dist/cjs/web/MockParamsProvider.js +0 -44
  158. package/dist/cjs/web/MockProviders.d.ts +0 -5
  159. package/dist/cjs/web/MockProviders.d.ts.map +0 -1
  160. package/dist/cjs/web/MockProviders.js +0 -60
  161. package/dist/cjs/web/MockRouter.d.ts +0 -11
  162. package/dist/cjs/web/MockRouter.d.ts.map +0 -1
  163. package/dist/cjs/web/MockRouter.js +0 -48
  164. package/dist/cjs/web/customRender.d.ts +0 -6
  165. package/dist/cjs/web/customRender.d.ts.map +0 -1
  166. package/dist/cjs/web/customRender.js +0 -54
  167. package/dist/cjs/web/fileMock.d.ts +0 -9
  168. package/dist/cjs/web/fileMock.d.ts.map +0 -1
  169. package/dist/cjs/web/fileMock.js +0 -24
  170. package/dist/cjs/web/findCellMocks.d.ts +0 -2
  171. package/dist/cjs/web/findCellMocks.d.ts.map +0 -1
  172. package/dist/cjs/web/findCellMocks.js +0 -45
  173. package/dist/cjs/web/globRoutesImporter.d.ts +0 -13
  174. package/dist/cjs/web/globRoutesImporter.d.ts.map +0 -1
  175. package/dist/cjs/web/globRoutesImporter.js +0 -46
  176. package/dist/cjs/web/global.d.ts +0 -6
  177. package/dist/cjs/web/global.d.ts.map +0 -1
  178. package/dist/cjs/web/global.js +0 -1
  179. package/dist/cjs/web/index.d.ts +0 -6
  180. package/dist/cjs/web/index.d.ts.map +0 -1
  181. package/dist/cjs/web/index.js +0 -41
  182. package/dist/cjs/web/mockAuth.d.ts +0 -29
  183. package/dist/cjs/web/mockAuth.d.ts.map +0 -1
  184. package/dist/cjs/web/mockAuth.js +0 -89
  185. package/dist/cjs/web/mockRequests.d.ts +0 -30
  186. package/dist/cjs/web/mockRequests.d.ts.map +0 -1
  187. package/dist/cjs/web/mockRequests.js +0 -139
  188. package/dist/cjs/web/vitest/index.d.ts +0 -4
  189. package/dist/cjs/web/vitest/index.d.ts.map +0 -1
  190. package/dist/cjs/web/vitest/index.js +0 -34
  191. package/dist/cjs/web/vitest/vite-plugin-auto-import.d.ts +0 -2
  192. package/dist/cjs/web/vitest/vite-plugin-auto-import.d.ts.map +0 -1
  193. package/dist/cjs/web/vitest/vite-plugin-auto-import.js +0 -60
  194. package/dist/cjs/web/vitest/vite-plugin-cedarjs-router-import-transform.d.ts +0 -7
  195. package/dist/cjs/web/vitest/vite-plugin-cedarjs-router-import-transform.d.ts.map +0 -1
  196. package/dist/cjs/web/vitest/vite-plugin-cedarjs-router-import-transform.js +0 -42
  197. package/dist/cjs/web/vitest/vite-plugin-create-auth-import-transform.d.ts +0 -3
  198. package/dist/cjs/web/vitest/vite-plugin-create-auth-import-transform.d.ts.map +0 -1
  199. package/dist/cjs/web/vitest/vite-plugin-create-auth-import-transform.js +0 -43
  200. package/dist/config/jest/api/RedwoodApiJestEnv.d.ts +0 -11
  201. package/dist/config/jest/api/RedwoodApiJestEnv.d.ts.map +0 -1
  202. package/dist/config/jest/api/RedwoodApiJestEnv.js +0 -28
  203. package/dist/config/jest/api/apiBabelConfig.d.ts +0 -5
  204. package/dist/config/jest/api/apiBabelConfig.d.ts.map +0 -1
  205. package/dist/config/jest/api/apiBabelConfig.js +0 -18
  206. package/dist/config/jest/api/globalSetup.d.ts +0 -3
  207. package/dist/config/jest/api/globalSetup.d.ts.map +0 -1
  208. package/dist/config/jest/api/globalSetup.js +0 -36
  209. package/dist/config/jest/api/index.d.ts +0 -3
  210. package/dist/config/jest/api/index.d.ts.map +0 -1
  211. package/dist/config/jest/api/index.js +0 -11
  212. package/dist/config/jest/api/jest-preset.d.ts +0 -4
  213. package/dist/config/jest/api/jest-preset.d.ts.map +0 -1
  214. package/dist/config/jest/api/jest-preset.js +0 -69
  215. package/dist/config/jest/api/jest.setup.d.ts +0 -2
  216. package/dist/config/jest/api/jest.setup.d.ts.map +0 -1
  217. package/dist/config/jest/api/jest.setup.js +0 -248
  218. package/dist/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts +0 -11
  219. package/dist/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts.map +0 -1
  220. package/dist/config/jest/babelPlugins/babel-plugin-redwood-cell.js +0 -101
  221. package/dist/config/jest/jest-serial-runner.d.ts +0 -8
  222. package/dist/config/jest/jest-serial-runner.d.ts.map +0 -1
  223. package/dist/config/jest/jest-serial-runner.js +0 -23
  224. package/dist/config/jest/web/RedwoodWebJestEnv.d.ts +0 -6
  225. package/dist/config/jest/web/RedwoodWebJestEnv.d.ts.map +0 -1
  226. package/dist/config/jest/web/RedwoodWebJestEnv.js +0 -18
  227. package/dist/config/jest/web/index.d.ts +0 -3
  228. package/dist/config/jest/web/index.d.ts.map +0 -1
  229. package/dist/config/jest/web/index.js +0 -11
  230. package/dist/config/jest/web/jest-preset.d.ts +0 -4
  231. package/dist/config/jest/web/jest-preset.d.ts.map +0 -1
  232. package/dist/config/jest/web/jest-preset.js +0 -89
  233. package/dist/config/jest/web/jest.setup.d.ts +0 -8
  234. package/dist/config/jest/web/jest.setup.d.ts.map +0 -1
  235. package/dist/config/jest/web/jest.setup.js +0 -28
  236. package/dist/config/jest/web/resolver.d.ts +0 -4
  237. package/dist/config/jest/web/resolver.d.ts.map +0 -1
  238. package/dist/config/jest/web/resolver.js +0 -38
  239. package/dist/config/jest/web/webBabelConfig.d.ts +0 -10
  240. package/dist/config/jest/web/webBabelConfig.d.ts.map +0 -1
  241. package/dist/config/jest/web/webBabelConfig.js +0 -18
  242. package/dist/web/fileMock.d.ts +0 -9
  243. package/dist/web/fileMock.d.ts.map +0 -1
  244. package/dist/web/fileMock.js +0 -4
@@ -1,37 +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 import_jest_runner = __toESM(require("jest-runner"), 1);
25
- const TestRunner = (
26
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
27
- // @ts-ignore
28
- import_jest_runner.default.default || import_jest_runner.default
29
- );
30
- class SerialRunner extends TestRunner {
31
- isSerial;
32
- constructor(...attr) {
33
- super(...attr);
34
- this.isSerial = true;
35
- }
36
- }
37
- module.exports = SerialRunner;
@@ -1,6 +0,0 @@
1
- import { TestEnvironment } from 'jest-environment-jsdom';
2
- declare class RedwoodWebJestEnvironment extends TestEnvironment {
3
- setup(): Promise<void>;
4
- }
5
- export default RedwoodWebJestEnvironment;
6
- //# sourceMappingURL=RedwoodWebJestEnv.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RedwoodWebJestEnv.d.ts","sourceRoot":"","sources":["../../../../../src/config/jest/web/RedwoodWebJestEnv.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAIxD,cAAM,yBAA0B,SAAQ,eAAe;IAC/C,KAAK;CAaZ;AAED,eAAe,yBAAyB,CAAA"}
@@ -1,38 +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 RedwoodWebJestEnv_exports = {};
20
- __export(RedwoodWebJestEnv_exports, {
21
- default: () => RedwoodWebJestEnv_default
22
- });
23
- module.exports = __toCommonJS(RedwoodWebJestEnv_exports);
24
- var import_node_util = require("node:util");
25
- var import_jest_environment_jsdom = require("jest-environment-jsdom");
26
- class RedwoodWebJestEnvironment extends import_jest_environment_jsdom.TestEnvironment {
27
- async setup() {
28
- await super.setup();
29
- if (typeof this.global.TextEncoder === "undefined") {
30
- this.global.TextEncoder = import_node_util.TextEncoder;
31
- this.global.TextDecoder = import_node_util.TextDecoder;
32
- }
33
- if (typeof this.global.crypto.subtle === "undefined") {
34
- this.global.crypto.subtle = {};
35
- }
36
- }
37
- }
38
- 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,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":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAOlC,QAAA,MAAM,MAAM,EAAE,MAkFb,CAAA;AAED,eAAe,MAAM,CAAA"}
@@ -1,119 +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_path = __toESM(require("node:path"), 1);
35
- var import_project_config = require("@cedarjs/project-config");
36
- const rwjsPaths = (0, import_project_config.getPaths)();
37
- const NODE_MODULES_PATH = import_node_path.default.join(rwjsPaths.base, "node_modules");
38
- const config = {
39
- // To make sure other config option which depends on rootDir always
40
- // use correct path, for example, coverageDirectory
41
- rootDir: rwjsPaths.base,
42
- roots: [import_node_path.default.join(rwjsPaths.web.src)],
43
- testEnvironment: import_node_path.default.join(__dirname, "./RedwoodWebJestEnv.js"),
44
- displayName: {
45
- color: "blueBright",
46
- name: "web"
47
- },
48
- globals: {
49
- __RWJS_TESTROOT_DIR: import_node_path.default.join(rwjsPaths.web.src),
50
- // used in jest setup to load mocks
51
- RWJS_ENV: {
52
- RWJS_API_URL: "",
53
- RWJS_API_GRAPHQL_URL: "/",
54
- __REDWOOD__APP_TITLE: "Redwood App"
55
- },
56
- RWJS_DEBUG_ENV: {
57
- RWJS_SRC_ROOT: rwjsPaths.web.src
58
- }
59
- },
60
- collectCoverageFrom: [
61
- "**/*.{js,jsx,ts,tsx}",
62
- "!**/node_modules/**",
63
- "!**/dist/**"
64
- ],
65
- coverageDirectory: import_node_path.default.join(rwjsPaths.base, "coverage"),
66
- watchPlugins: [
67
- "jest-watch-typeahead/filename",
68
- "jest-watch-typeahead/testname"
69
- ],
70
- setupFilesAfterEnv: [import_node_path.default.resolve(__dirname, "./jest.setup.js")],
71
- moduleNameMapper: {
72
- /**
73
- * Make sure modules that require different versions of these
74
- * dependencies end up using the same one.
75
- */
76
- "^react$": import_node_path.default.join(NODE_MODULES_PATH, "react"),
77
- "^react-dom$": import_node_path.default.join(NODE_MODULES_PATH, "react-dom"),
78
- "^@apollo/client/react$": import_node_path.default.join(
79
- NODE_MODULES_PATH,
80
- "@apollo/client/react"
81
- ),
82
- // We replace imports to "@cedarjs/router" with our own "mock" implementation.
83
- "^@cedarjs/router$": import_node_path.default.join(
84
- NODE_MODULES_PATH,
85
- "@cedarjs/testing/dist/cjs/web/MockRouter.js"
86
- ),
87
- "^@cedarjs/web$": import_node_path.default.join(NODE_MODULES_PATH, "@cedarjs/web/dist/cjs"),
88
- // This allows us to mock `createAuthentication` which is used by auth
89
- // clients, which in turn lets us mock `useAuth` in tests
90
- "^@cedarjs/auth$": import_node_path.default.join(
91
- NODE_MODULES_PATH,
92
- "@cedarjs/testing/dist/cjs/web/mockAuth.js"
93
- ),
94
- // @NOTE: Import @cedarjs/testing in web tests, and it automatically remaps to the web side only
95
- // This is to prevent web stuff leaking into api, and vice versa
96
- "^@cedarjs/testing$": import_node_path.default.join(NODE_MODULES_PATH, "@cedarjs/testing/web"),
97
- "~__REDWOOD__USER_ROUTES_FOR_MOCK": rwjsPaths.web.routes,
98
- "~__REDWOOD__USER_AUTH_FOR_MOCK": import_node_path.default.join(rwjsPaths.web.src, "auth"),
99
- /**
100
- * Mock out files that aren't particularly useful in tests. See fileMock.js for more info.
101
- */
102
- "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|css)$": "@cedarjs/testing/dist/cjs/web/fileMock.js",
103
- // Support for importing files with extensions (like you'd do in ESM projects)
104
- "^(\\.{1,2}/.*)\\.js$": "$1"
105
- },
106
- transform: {
107
- "\\.[jt]sx?$": [
108
- "babel-jest",
109
- // When jest runs tests in parallel, it serializes the config before passing down options to babel
110
- // that's why these must be serializable. Passing the reference to a config instead.
111
- {
112
- configFile: import_node_path.default.resolve(__dirname, "./webBabelConfig.js")
113
- }
114
- ]
115
- },
116
- resolver: import_node_path.default.resolve(__dirname, "./resolver.js"),
117
- testPathIgnorePatterns: [".(stories|mock).[jt]sx?$"]
118
- };
119
- var jest_preset_default = config;
@@ -1,8 +0,0 @@
1
- import '@testing-library/jest-dom';
2
- import 'whatwg-fetch';
3
- import { mockCurrentUser as _mockCurrentUser } from '../../../web/mockRequests.js';
4
- declare global {
5
- var __RWJS_TESTROOT_DIR: string;
6
- var mockCurrentUser: typeof _mockCurrentUser;
7
- }
8
- //# 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;AAClC,OAAO,cAAc,CAAA;AAGrB,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,22 +0,0 @@
1
- "use strict";
2
- var import_jest_dom = require("@testing-library/jest-dom");
3
- var import_whatwg_fetch = require("whatwg-fetch");
4
- var import_findCellMocks = require("@cedarjs/testing/dist/cjs/web/findCellMocks.js");
5
- var import_mockRequests = require("@cedarjs/testing/dist/cjs/web/mockRequests.js");
6
- global.mockGraphQLQuery = import_mockRequests.mockGraphQLQuery;
7
- global.mockGraphQLMutation = import_mockRequests.mockGraphQLMutation;
8
- global.mockCurrentUser = import_mockRequests.mockCurrentUser;
9
- const cellMocks = (0, import_findCellMocks.findCellMocks)(global.__RWJS_TESTROOT_DIR);
10
- beforeAll(async () => {
11
- for (const m of cellMocks) {
12
- require(m);
13
- }
14
- await (0, import_mockRequests.startMSW)("node");
15
- (0, import_mockRequests.setupRequestHandlers)();
16
- });
17
- afterEach(() => {
18
- (0, import_mockRequests.setupRequestHandlers)();
19
- });
20
- afterAll(() => {
21
- (0, import_mockRequests.closeServer)();
22
- });
@@ -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,3 +0,0 @@
1
- export declare function getDefaultDb(projectBaseDir: string): string;
2
- export declare function checkAndReplaceDirectUrl(prismaSchema: string, defaultDb: string): string | undefined;
3
- //# sourceMappingURL=directUrlHelpers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"directUrlHelpers.d.ts","sourceRoot":"","sources":["../../src/api/directUrlHelpers.ts"],"names":[],"mappings":"AAEA,wBAAgB,YAAY,CAAC,cAAc,EAAE,MAAM,UAElD;AAED,wBAAgB,wBAAwB,CACtC,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,sBA+BlB"}
@@ -1,25 +0,0 @@
1
- import path from "path";
2
- function getDefaultDb(projectBaseDir) {
3
- return `file:${path.join(projectBaseDir, ".redwood", "test.db")}`;
4
- }
5
- function checkAndReplaceDirectUrl(prismaSchema, defaultDb) {
6
- const directUrl = prismaSchema.match(PRISMA_DIRECT_URL_REGEXP);
7
- if (!directUrl) {
8
- return;
9
- }
10
- const directUrlEnvMatch = directUrl[0].match(BETWEEN_PARENTHESES_REGEXP);
11
- if (!directUrlEnvMatch) {
12
- throw new Error(
13
- "Error parsing `directUrl` from schema.prisma. Proceeding with this env var could be dangerous. Please check your schema.prisma file; if everything looks ok, file an issue."
14
- );
15
- }
16
- const directUrlEnv = directUrlEnvMatch[2];
17
- process.env[directUrlEnv] = process.env.TEST_DIRECT_URL || process.env.TEST_DATABASE_URL || defaultDb;
18
- return directUrlEnv;
19
- }
20
- const PRISMA_DIRECT_URL_REGEXP = /directUrl(\s*)=(\s*)env\(('|")(.*)('|")\)/g;
21
- const BETWEEN_PARENTHESES_REGEXP = /\(('|")([^)]+)('|")\)/;
22
- export {
23
- checkAndReplaceDirectUrl,
24
- getDefaultDb
25
- };
@@ -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,3 +0,0 @@
1
- export declare function getDefaultDb(projectBaseDir: string): string;
2
- export declare function checkAndReplaceDirectUrl(prismaSchema: string, defaultDb: string): string | undefined;
3
- //# sourceMappingURL=directUrlHelpers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"directUrlHelpers.d.ts","sourceRoot":"","sources":["../../../src/api/directUrlHelpers.ts"],"names":[],"mappings":"AAEA,wBAAgB,YAAY,CAAC,cAAc,EAAE,MAAM,UAElD;AAED,wBAAgB,wBAAwB,CACtC,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,sBA+BlB"}
@@ -1,60 +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 directUrlHelpers_exports = {};
30
- __export(directUrlHelpers_exports, {
31
- checkAndReplaceDirectUrl: () => checkAndReplaceDirectUrl,
32
- getDefaultDb: () => getDefaultDb
33
- });
34
- module.exports = __toCommonJS(directUrlHelpers_exports);
35
- var import_path = __toESM(require("path"), 1);
36
- function getDefaultDb(projectBaseDir) {
37
- return `file:${import_path.default.join(projectBaseDir, ".redwood", "test.db")}`;
38
- }
39
- function checkAndReplaceDirectUrl(prismaSchema, defaultDb) {
40
- const directUrl = prismaSchema.match(PRISMA_DIRECT_URL_REGEXP);
41
- if (!directUrl) {
42
- return;
43
- }
44
- const directUrlEnvMatch = directUrl[0].match(BETWEEN_PARENTHESES_REGEXP);
45
- if (!directUrlEnvMatch) {
46
- throw new Error(
47
- "Error parsing `directUrl` from schema.prisma. Proceeding with this env var could be dangerous. Please check your schema.prisma file; if everything looks ok, file an issue."
48
- );
49
- }
50
- const directUrlEnv = directUrlEnvMatch[2];
51
- process.env[directUrlEnv] = process.env.TEST_DIRECT_URL || process.env.TEST_DATABASE_URL || defaultDb;
52
- return directUrlEnv;
53
- }
54
- const PRISMA_DIRECT_URL_REGEXP = /directUrl(\s*)=(\s*)env\(('|")(.*)('|")\)/g;
55
- const BETWEEN_PARENTHESES_REGEXP = /\(('|")([^)]+)('|")\)/;
56
- // Annotate the CommonJS export names for ESM import in node:
57
- 0 && (module.exports = {
58
- checkAndReplaceDirectUrl,
59
- getDefaultDb
60
- });