@cedarjs/testing 7.0.0-canary.2983 → 7.0.0-canary.2985

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 (142) hide show
  1. package/dist/cjs/web/MockRouter.d.ts.map +1 -1
  2. package/dist/cjs/web/mockRequests.js +2 -2
  3. package/dist/web/MockRouter.d.ts.map +1 -1
  4. package/package.json +12 -53
  5. package/config/jest/api/RedwoodApiJestEnv.d.ts +0 -11
  6. package/config/jest/api/RedwoodApiJestEnv.d.ts.map +0 -1
  7. package/config/jest/api/RedwoodApiJestEnv.js +0 -48
  8. package/config/jest/api/apiBabelConfig.d.ts +0 -5
  9. package/config/jest/api/apiBabelConfig.d.ts.map +0 -1
  10. package/config/jest/api/apiBabelConfig.js +0 -34
  11. package/config/jest/api/globalSetup.d.ts +0 -3
  12. package/config/jest/api/globalSetup.d.ts.map +0 -1
  13. package/config/jest/api/globalSetup.js +0 -63
  14. package/config/jest/api/index.d.ts +0 -3
  15. package/config/jest/api/index.d.ts.map +0 -1
  16. package/config/jest/api/index.js +0 -25
  17. package/config/jest/api/jest-preset.d.ts +0 -4
  18. package/config/jest/api/jest-preset.d.ts.map +0 -1
  19. package/config/jest/api/jest-preset.js +0 -135
  20. package/config/jest/api/jest.setup.d.ts +0 -2
  21. package/config/jest/api/jest.setup.d.ts.map +0 -1
  22. package/config/jest/api/jest.setup.js +0 -267
  23. package/config/jest/api/package.json +0 -8
  24. package/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts +0 -11
  25. package/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts.map +0 -1
  26. package/config/jest/babelPlugins/babel-plugin-redwood-cell.js +0 -122
  27. package/config/jest/jest-serial-runner.d.ts +0 -8
  28. package/config/jest/jest-serial-runner.d.ts.map +0 -1
  29. package/config/jest/jest-serial-runner.js +0 -37
  30. package/config/jest/web/RedwoodWebJestEnv.d.ts +0 -6
  31. package/config/jest/web/RedwoodWebJestEnv.d.ts.map +0 -1
  32. package/config/jest/web/RedwoodWebJestEnv.js +0 -43
  33. package/config/jest/web/index.d.ts +0 -3
  34. package/config/jest/web/index.d.ts.map +0 -1
  35. package/config/jest/web/index.js +0 -25
  36. package/config/jest/web/jest-fixed-jsdom.d.js +0 -1
  37. package/config/jest/web/jest-preset.d.ts +0 -4
  38. package/config/jest/web/jest-preset.d.ts.map +0 -1
  39. package/config/jest/web/jest-preset.js +0 -224
  40. package/config/jest/web/jest.setup.d.ts +0 -7
  41. package/config/jest/web/jest.setup.d.ts.map +0 -1
  42. package/config/jest/web/jest.setup.js +0 -21
  43. package/config/jest/web/package.json +0 -8
  44. package/config/jest/web/resolver.d.ts +0 -4
  45. package/config/jest/web/resolver.d.ts.map +0 -1
  46. package/config/jest/web/resolver.js +0 -30
  47. package/config/jest/web/webBabelConfig.d.ts +0 -10
  48. package/config/jest/web/webBabelConfig.d.ts.map +0 -1
  49. package/config/jest/web/webBabelConfig.js +0 -48
  50. package/config/package.json +0 -1
  51. package/dist/cjs/config/jest/api/RedwoodApiJestEnv.d.ts +0 -11
  52. package/dist/cjs/config/jest/api/RedwoodApiJestEnv.d.ts.map +0 -1
  53. package/dist/cjs/config/jest/api/RedwoodApiJestEnv.js +0 -48
  54. package/dist/cjs/config/jest/api/apiBabelConfig.d.ts +0 -5
  55. package/dist/cjs/config/jest/api/apiBabelConfig.d.ts.map +0 -1
  56. package/dist/cjs/config/jest/api/apiBabelConfig.js +0 -34
  57. package/dist/cjs/config/jest/api/globalSetup.d.ts +0 -3
  58. package/dist/cjs/config/jest/api/globalSetup.d.ts.map +0 -1
  59. package/dist/cjs/config/jest/api/globalSetup.js +0 -63
  60. package/dist/cjs/config/jest/api/index.d.ts +0 -3
  61. package/dist/cjs/config/jest/api/index.d.ts.map +0 -1
  62. package/dist/cjs/config/jest/api/index.js +0 -25
  63. package/dist/cjs/config/jest/api/jest-preset.d.ts +0 -4
  64. package/dist/cjs/config/jest/api/jest-preset.d.ts.map +0 -1
  65. package/dist/cjs/config/jest/api/jest-preset.js +0 -135
  66. package/dist/cjs/config/jest/api/jest.setup.d.ts +0 -2
  67. package/dist/cjs/config/jest/api/jest.setup.d.ts.map +0 -1
  68. package/dist/cjs/config/jest/api/jest.setup.js +0 -267
  69. package/dist/cjs/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts +0 -11
  70. package/dist/cjs/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts.map +0 -1
  71. package/dist/cjs/config/jest/babelPlugins/babel-plugin-redwood-cell.js +0 -122
  72. package/dist/cjs/config/jest/jest-serial-runner.d.ts +0 -8
  73. package/dist/cjs/config/jest/jest-serial-runner.d.ts.map +0 -1
  74. package/dist/cjs/config/jest/jest-serial-runner.js +0 -37
  75. package/dist/cjs/config/jest/web/RedwoodWebJestEnv.d.ts +0 -6
  76. package/dist/cjs/config/jest/web/RedwoodWebJestEnv.d.ts.map +0 -1
  77. package/dist/cjs/config/jest/web/RedwoodWebJestEnv.js +0 -43
  78. package/dist/cjs/config/jest/web/index.d.ts +0 -3
  79. package/dist/cjs/config/jest/web/index.d.ts.map +0 -1
  80. package/dist/cjs/config/jest/web/index.js +0 -25
  81. package/dist/cjs/config/jest/web/jest-fixed-jsdom.d.js +0 -1
  82. package/dist/cjs/config/jest/web/jest-preset.d.ts +0 -4
  83. package/dist/cjs/config/jest/web/jest-preset.d.ts.map +0 -1
  84. package/dist/cjs/config/jest/web/jest-preset.js +0 -224
  85. package/dist/cjs/config/jest/web/jest.setup.d.ts +0 -7
  86. package/dist/cjs/config/jest/web/jest.setup.d.ts.map +0 -1
  87. package/dist/cjs/config/jest/web/jest.setup.js +0 -21
  88. package/dist/cjs/config/jest/web/resolver.d.ts +0 -4
  89. package/dist/cjs/config/jest/web/resolver.d.ts.map +0 -1
  90. package/dist/cjs/config/jest/web/resolver.js +0 -30
  91. package/dist/cjs/config/jest/web/webBabelConfig.d.ts +0 -10
  92. package/dist/cjs/config/jest/web/webBabelConfig.d.ts.map +0 -1
  93. package/dist/cjs/config/jest/web/webBabelConfig.js +0 -48
  94. package/dist/cjs/web/fileMock.d.ts +0 -10
  95. package/dist/cjs/web/fileMock.d.ts.map +0 -1
  96. package/dist/cjs/web/fileMock.js +0 -24
  97. package/dist/config/jest/api/RedwoodApiJestEnv.d.ts +0 -11
  98. package/dist/config/jest/api/RedwoodApiJestEnv.d.ts.map +0 -1
  99. package/dist/config/jest/api/RedwoodApiJestEnv.js +0 -28
  100. package/dist/config/jest/api/apiBabelConfig.d.ts +0 -5
  101. package/dist/config/jest/api/apiBabelConfig.d.ts.map +0 -1
  102. package/dist/config/jest/api/apiBabelConfig.js +0 -18
  103. package/dist/config/jest/api/globalSetup.d.ts +0 -3
  104. package/dist/config/jest/api/globalSetup.d.ts.map +0 -1
  105. package/dist/config/jest/api/globalSetup.js +0 -36
  106. package/dist/config/jest/api/index.d.ts +0 -3
  107. package/dist/config/jest/api/index.d.ts.map +0 -1
  108. package/dist/config/jest/api/index.js +0 -15
  109. package/dist/config/jest/api/jest-preset.d.ts +0 -4
  110. package/dist/config/jest/api/jest-preset.d.ts.map +0 -1
  111. package/dist/config/jest/api/jest-preset.js +0 -105
  112. package/dist/config/jest/api/jest.setup.d.ts +0 -2
  113. package/dist/config/jest/api/jest.setup.d.ts.map +0 -1
  114. package/dist/config/jest/api/jest.setup.js +0 -244
  115. package/dist/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts +0 -11
  116. package/dist/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts.map +0 -1
  117. package/dist/config/jest/babelPlugins/babel-plugin-redwood-cell.js +0 -102
  118. package/dist/config/jest/jest-serial-runner.d.ts +0 -8
  119. package/dist/config/jest/jest-serial-runner.d.ts.map +0 -1
  120. package/dist/config/jest/jest-serial-runner.js +0 -27
  121. package/dist/config/jest/web/RedwoodWebJestEnv.d.ts +0 -6
  122. package/dist/config/jest/web/RedwoodWebJestEnv.d.ts.map +0 -1
  123. package/dist/config/jest/web/RedwoodWebJestEnv.js +0 -13
  124. package/dist/config/jest/web/index.d.ts +0 -3
  125. package/dist/config/jest/web/index.d.ts.map +0 -1
  126. package/dist/config/jest/web/index.js +0 -15
  127. package/dist/config/jest/web/jest-fixed-jsdom.d.js +0 -0
  128. package/dist/config/jest/web/jest-preset.d.ts +0 -4
  129. package/dist/config/jest/web/jest-preset.d.ts.map +0 -1
  130. package/dist/config/jest/web/jest-preset.js +0 -194
  131. package/dist/config/jest/web/jest.setup.d.ts +0 -7
  132. package/dist/config/jest/web/jest.setup.d.ts.map +0 -1
  133. package/dist/config/jest/web/jest.setup.js +0 -27
  134. package/dist/config/jest/web/resolver.d.ts +0 -4
  135. package/dist/config/jest/web/resolver.d.ts.map +0 -1
  136. package/dist/config/jest/web/resolver.js +0 -42
  137. package/dist/config/jest/web/webBabelConfig.d.ts +0 -10
  138. package/dist/config/jest/web/webBabelConfig.d.ts.map +0 -1
  139. package/dist/config/jest/web/webBabelConfig.js +0 -18
  140. package/dist/web/fileMock.d.ts +0 -10
  141. package/dist/web/fileMock.d.ts.map +0 -1
  142. package/dist/web/fileMock.js +0 -4
@@ -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,11 +0,0 @@
1
- import type { EnvironmentContext, JestEnvironmentConfig } from '@jest/environment';
2
- import { TestEnvironment } from 'jest-environment-node';
3
- declare class RedwoodApiJestEnvironment extends TestEnvironment {
4
- private testPath;
5
- constructor(config: JestEnvironmentConfig, context: EnvironmentContext);
6
- setup(): Promise<void>;
7
- teardown(): Promise<void>;
8
- getVmContext(): import("vm").Context | null;
9
- }
10
- export default RedwoodApiJestEnvironment;
11
- //# sourceMappingURL=RedwoodApiJestEnv.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RedwoodApiJestEnv.d.ts","sourceRoot":"","sources":["../../../../../src/config/jest/api/RedwoodApiJestEnv.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEvD,cAAM,yBAA0B,SAAQ,eAAe;IACrD,OAAO,CAAC,QAAQ,CAAQ;gBAEZ,MAAM,EAAE,qBAAqB,EAAE,OAAO,EAAE,kBAAkB;IAKhE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAMtB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAI/B,YAAY;CAUb;AAED,eAAe,yBAAyB,CAAA"}
@@ -1,48 +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 RedwoodApiJestEnv_exports = {};
20
- __export(RedwoodApiJestEnv_exports, {
21
- default: () => RedwoodApiJestEnv_default
22
- });
23
- module.exports = __toCommonJS(RedwoodApiJestEnv_exports);
24
- var import_jest_environment_node = require("jest-environment-node");
25
- class RedwoodApiJestEnvironment extends import_jest_environment_node.TestEnvironment {
26
- testPath;
27
- constructor(config, context) {
28
- super(config, context);
29
- this.testPath = context.testPath;
30
- }
31
- async setup() {
32
- await super.setup();
33
- this.global.testPath = this.testPath;
34
- }
35
- async teardown() {
36
- await super.teardown();
37
- }
38
- getVmContext() {
39
- return super.getVmContext();
40
- }
41
- // async handleTestEvent(event, state) {
42
- // if (event.name === 'test_start') {
43
- // // Link to event docs:
44
- // // https://github.com/facebook/jest/blob/master/packages/jest-types/src/Circus.ts
45
- // }
46
- // }
47
- }
48
- var RedwoodApiJestEnv_default = RedwoodApiJestEnvironment;
@@ -1,5 +0,0 @@
1
- import { getApiSideDefaultBabelConfig } from '@cedarjs/babel-config';
2
- type ConfigType = Omit<ReturnType<typeof getApiSideDefaultBabelConfig>, 'babelrc'>;
3
- declare const config: ConfigType;
4
- export default config;
5
- //# sourceMappingURL=apiBabelConfig.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"apiBabelConfig.d.ts","sourceRoot":"","sources":["../../../../../src/config/jest/api/apiBabelConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAG7B,MAAM,uBAAuB,CAAA;AAO9B,KAAK,UAAU,GAAG,IAAI,CACpB,UAAU,CAAC,OAAO,4BAA4B,CAAC,EAC/C,SAAS,CACV,CAAA;AAED,QAAA,MAAM,MAAM,EAAE,UAMb,CAAA;AAED,eAAe,MAAM,CAAA"}
@@ -1,34 +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 apiBabelConfig_exports = {};
20
- __export(apiBabelConfig_exports, {
21
- default: () => apiBabelConfig_default
22
- });
23
- module.exports = __toCommonJS(apiBabelConfig_exports);
24
- var import_babel_config = require("@cedarjs/babel-config");
25
- const { babelrc: _b, ...defaultBabelConfig } = (0, import_babel_config.getApiSideDefaultBabelConfig)();
26
- const config = {
27
- ...defaultBabelConfig,
28
- plugins: (0, import_babel_config.getApiSideBabelPlugins)(),
29
- presets: (0, import_babel_config.getApiSideBabelPresets)({
30
- presetEnv: true
31
- // jest needs code transpiled
32
- })
33
- };
34
- var apiBabelConfig_default = config;
@@ -1,3 +0,0 @@
1
- import 'dotenv-defaults/config';
2
- export default function (): Promise<void>;
3
- //# sourceMappingURL=globalSetup.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"globalSetup.d.ts","sourceRoot":"","sources":["../../../../../src/config/jest/api/globalSetup.ts"],"names":[],"mappings":"AAEA,OAAO,wBAAwB,CAAA;AAW/B,0CAqCC"}
@@ -1,63 +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 globalSetup_exports = {};
30
- __export(globalSetup_exports, {
31
- default: () => globalSetup_default
32
- });
33
- module.exports = __toCommonJS(globalSetup_exports);
34
- var import_node_path = __toESM(require("node:path"), 1);
35
- var import_config = require("dotenv-defaults/config");
36
- var import_execa = __toESM(require("execa"), 1);
37
- var import_project_config = require("@cedarjs/project-config");
38
- var import_packageManager = require("@cedarjs/project-config/packageManager");
39
- var import_checkTestDatabase = require("../../../api/checkTestDatabase.js");
40
- async function globalSetup_default() {
41
- if (process.env.SKIP_DB_PUSH === "1") {
42
- return;
43
- }
44
- const cedarPaths = (0, import_project_config.getPaths)();
45
- const defaultDb = `file:${import_node_path.default.join(cedarPaths.generated.base, "test.db")}`;
46
- const usedFallback = !process.env.TEST_DATABASE_URL;
47
- process.env.DATABASE_URL = process.env.TEST_DATABASE_URL || defaultDb;
48
- await (0, import_checkTestDatabase.checkTestDatabaseUrlMatchesProvider)(
49
- process.env.DATABASE_URL,
50
- usedFallback
51
- );
52
- console.log(
53
- `Setting up test database: ${(0, import_checkTestDatabase.redactDatabaseUrl)(process.env.DATABASE_URL)}`
54
- );
55
- const command = process.env.TEST_DATABASE_STRATEGY === "reset" ? ["prisma", "migrate", "reset", "--force"] : ["prisma", "db", "push", "--force-reset", "--accept-data-loss"];
56
- const pm = (0, import_packageManager.getPackageManager)();
57
- const pmExec = pm === "pnpm" ? pm : "npx";
58
- import_execa.default.sync(pmExec, ["cedar", ...command], {
59
- cwd: cedarPaths.api.base,
60
- stdio: "inherit",
61
- env: process.env
62
- });
63
- }
@@ -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/api/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAA;AAK9C,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/api/jest-preset.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAkClC,QAAA,MAAM,MAAM,EAAE,MAqFb,CAAA;AAED,eAAe,MAAM,CAAA"}