@cedarjs/testing 5.0.3 → 5.0.4-next.167
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/jest/api/apiBabelConfig.d.ts.map +1 -1
- package/config/jest/api/apiBabelConfig.js +1 -3
- package/config/jest/api/jest-preset.d.ts.map +1 -1
- package/config/jest/api/jest-preset.js +38 -3
- package/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts.map +1 -1
- package/config/jest/babelPlugins/babel-plugin-redwood-cell.js +2 -1
- package/config/jest/web/RedwoodWebJestEnv.d.ts +2 -2
- package/config/jest/web/RedwoodWebJestEnv.d.ts.map +1 -1
- package/config/jest/web/RedwoodWebJestEnv.js +12 -7
- package/config/jest/web/jest-fixed-jsdom.d.js +1 -0
- package/config/jest/web/jest-preset.d.ts.map +1 -1
- package/config/jest/web/jest-preset.js +135 -30
- package/config/jest/web/jest.setup.d.ts +0 -1
- package/config/jest/web/jest.setup.d.ts.map +1 -1
- package/config/jest/web/jest.setup.js +0 -1
- package/dist/api/vitest/CedarApiVitestEnv.js +1 -1
- package/dist/api/vitest/vite-plugin-cedar-vitest-api-config.js +7 -7
- package/dist/api/vitest/vitest-api.setup.js +4 -4
- package/dist/cjs/api/vitest/CedarApiVitestEnv.js +1 -1
- package/dist/cjs/api/vitest/vite-plugin-cedar-vitest-api-config.js +7 -7
- package/dist/cjs/api/vitest/vitest-api.setup.js +4 -4
- package/dist/cjs/config/jest/api/apiBabelConfig.d.ts.map +1 -1
- package/dist/cjs/config/jest/api/apiBabelConfig.js +1 -3
- package/dist/cjs/config/jest/api/jest-preset.d.ts.map +1 -1
- package/dist/cjs/config/jest/api/jest-preset.js +38 -3
- package/dist/cjs/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts.map +1 -1
- package/dist/cjs/config/jest/babelPlugins/babel-plugin-redwood-cell.js +2 -1
- package/dist/cjs/config/jest/web/RedwoodWebJestEnv.d.ts +2 -2
- package/dist/cjs/config/jest/web/RedwoodWebJestEnv.d.ts.map +1 -1
- package/dist/cjs/config/jest/web/RedwoodWebJestEnv.js +12 -7
- package/dist/cjs/config/jest/web/jest-fixed-jsdom.d.js +1 -0
- package/dist/cjs/config/jest/web/jest-preset.d.ts.map +1 -1
- package/dist/cjs/config/jest/web/jest-preset.js +135 -30
- package/dist/cjs/config/jest/web/jest.setup.d.ts +0 -1
- package/dist/cjs/config/jest/web/jest.setup.d.ts.map +1 -1
- package/dist/cjs/config/jest/web/jest.setup.js +0 -1
- package/dist/cjs/web/MockProviders.js +9 -3
- package/dist/cjs/web/mockRequests.d.ts +60 -18
- package/dist/cjs/web/mockRequests.d.ts.map +1 -1
- package/dist/cjs/web/mockRequests.js +107 -36
- package/dist/cjs/web/vitest/index.js +3 -0
- package/dist/cjs/web/vitest/vite-plugin-cedar-vitest-web-config.js +51 -0
- package/dist/cjs/web/vitest/vitest-web.setup.js +19 -0
- package/dist/config/jest/api/apiBabelConfig.d.ts.map +1 -1
- package/dist/config/jest/api/apiBabelConfig.js +1 -3
- package/dist/config/jest/api/index.js +5 -1
- package/dist/config/jest/api/jest-preset.d.ts.map +1 -1
- package/dist/config/jest/api/jest-preset.js +38 -3
- package/dist/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts.map +1 -1
- package/dist/config/jest/babelPlugins/babel-plugin-redwood-cell.js +2 -1
- package/dist/config/jest/jest-serial-runner.js +5 -1
- package/dist/config/jest/web/RedwoodWebJestEnv.d.ts +2 -2
- package/dist/config/jest/web/RedwoodWebJestEnv.d.ts.map +1 -1
- package/dist/config/jest/web/RedwoodWebJestEnv.js +2 -7
- package/dist/config/jest/web/index.js +5 -1
- package/dist/config/jest/web/jest-fixed-jsdom.d.js +0 -0
- package/dist/config/jest/web/jest-preset.d.ts.map +1 -1
- package/dist/config/jest/web/jest-preset.js +135 -30
- package/dist/config/jest/web/jest.setup.d.ts +0 -1
- package/dist/config/jest/web/jest.setup.d.ts.map +1 -1
- package/dist/config/jest/web/jest.setup.js +0 -1
- package/dist/config/jest/web/resolver.js +5 -1
- package/dist/web/MockProviders.js +9 -3
- package/dist/web/mockRequests.d.ts +60 -18
- package/dist/web/mockRequests.d.ts.map +1 -1
- package/dist/web/mockRequests.js +108 -37
- package/dist/web/vitest/index.d.ts +1 -0
- package/dist/web/vitest/index.d.ts.map +1 -1
- package/dist/web/vitest/index.js +2 -0
- package/dist/web/vitest/vite-plugin-cedar-vitest-web-config.d.ts +12 -0
- package/dist/web/vitest/vite-plugin-cedar-vitest-web-config.d.ts.map +1 -0
- package/dist/web/vitest/vite-plugin-cedar-vitest-web-config.js +16 -0
- package/dist/web/vitest/vitest-web.setup.d.ts +2 -0
- package/dist/web/vitest/vitest-web.setup.d.ts.map +1 -0
- package/dist/web/vitest/vitest-web.setup.js +18 -0
- package/package.json +23 -21
- package/dist/cjs/web/vitest/index.d.ts +0 -4
- package/dist/cjs/web/vitest/index.d.ts.map +0 -1
- package/dist/cjs/web/vitest/vite-plugin-auto-import.d.ts +0 -2
- package/dist/cjs/web/vitest/vite-plugin-auto-import.d.ts.map +0 -1
- package/dist/cjs/web/vitest/vite-plugin-cedarjs-router-import-transform.d.ts +0 -7
- package/dist/cjs/web/vitest/vite-plugin-cedarjs-router-import-transform.d.ts.map +0 -1
- package/dist/cjs/web/vitest/vite-plugin-create-auth-import-transform.d.ts +0 -3
- package/dist/cjs/web/vitest/vite-plugin-create-auth-import-transform.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
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;
|
|
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"}
|
|
@@ -22,9 +22,7 @@ __export(apiBabelConfig_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(apiBabelConfig_exports);
|
|
24
24
|
var import_babel_config = require("@cedarjs/babel-config");
|
|
25
|
-
const { babelrc: _b, ...defaultBabelConfig } = (0, import_babel_config.getApiSideDefaultBabelConfig)(
|
|
26
|
-
forJest: true
|
|
27
|
-
});
|
|
25
|
+
const { babelrc: _b, ...defaultBabelConfig } = (0, import_babel_config.getApiSideDefaultBabelConfig)();
|
|
28
26
|
const config = {
|
|
29
27
|
...defaultBabelConfig,
|
|
30
28
|
plugins: (0, import_babel_config.getApiSideBabelPlugins)(),
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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"}
|
|
@@ -35,8 +35,17 @@ var import_node_path = __toESM(require("node:path"), 1);
|
|
|
35
35
|
var import_babel_config = require("@cedarjs/babel-config");
|
|
36
36
|
var import_project_config = require("@cedarjs/project-config");
|
|
37
37
|
const rwjsPaths = (0, import_project_config.getPaths)();
|
|
38
|
-
const
|
|
39
|
-
|
|
38
|
+
const { babelrc } = (0, import_babel_config.getApiSideDefaultBabelConfig)();
|
|
39
|
+
function resolveSubpath(specifier) {
|
|
40
|
+
try {
|
|
41
|
+
return require.resolve(specifier, {
|
|
42
|
+
paths: [rwjsPaths.api.base, rwjsPaths.base]
|
|
43
|
+
});
|
|
44
|
+
} catch {
|
|
45
|
+
return void 0;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const testingApiPath = resolveSubpath("@cedarjs/testing/api");
|
|
40
49
|
const config = {
|
|
41
50
|
// To make sure other config option which depends on rootDir use
|
|
42
51
|
// correct path, for example, coverageDirectory
|
|
@@ -77,11 +86,34 @@ const config = {
|
|
|
77
86
|
"^src/(.*)$": import_node_path.default.join(rwjsPaths.api.src, "$1"),
|
|
78
87
|
// @NOTE: Import @cedarjs/testing in api tests, and it automatically remaps to the api side only
|
|
79
88
|
// This is to prevent web stuff leaking into api, and vice versa
|
|
80
|
-
"^@cedarjs/testing$":
|
|
89
|
+
...testingApiPath ? { "^@cedarjs/testing$": testingApiPath } : {},
|
|
81
90
|
// Support for importing files with extensions (like you'd do in ESM projects)
|
|
82
91
|
"^(\\.{1,2}/.*)\\.js$": "$1"
|
|
83
92
|
},
|
|
84
93
|
transform: {
|
|
94
|
+
// `@cedarjs/context`, `@cedarjs/api`, `@cedarjs/graphql-server`, and
|
|
95
|
+
// `@cedarjs/storage` are ESM-only. Two things pull them in at the top
|
|
96
|
+
// level of a generated project's api-side test run: @cedarjs/testing's
|
|
97
|
+
// own api entry point (which virtually every test imports, for
|
|
98
|
+
// scenario/mock helpers — pulls in `@cedarjs/context` and
|
|
99
|
+
// `@cedarjs/graphql-server` via `directive.ts`, and
|
|
100
|
+
// `@cedarjs/api/webhooks` via `apiFunction.ts`), and the *user's own*
|
|
101
|
+
// generated code — the `cedar setup uploads` template imports
|
|
102
|
+
// `@cedarjs/storage`. Jest's CJS runtime can't parse the real ESM these
|
|
103
|
+
// now emit, so they need the same babel-jest carve-out the web preset
|
|
104
|
+
// already uses for ESM-only node_modules packages (see jest-preset.ts
|
|
105
|
+
// on the web side for the fuller explanation of why this is
|
|
106
|
+
// necessary).
|
|
107
|
+
"[/\\\\]node_modules[/\\\\]@cedarjs[/\\\\](context|api|graphql-server|storage)[/\\\\].+\\.js$": [
|
|
108
|
+
"babel-jest",
|
|
109
|
+
{
|
|
110
|
+
babelrc: false,
|
|
111
|
+
configFile: false,
|
|
112
|
+
presets: [
|
|
113
|
+
[require.resolve("@babel/preset-env"), { targets: { node: "20" } }]
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
],
|
|
85
117
|
"\\.[cm]?[jt]sx?$": [
|
|
86
118
|
"babel-jest",
|
|
87
119
|
// When jest runs tests in parallel, it serializes the config before passing down options to babel
|
|
@@ -95,6 +127,9 @@ const config = {
|
|
|
95
127
|
}
|
|
96
128
|
]
|
|
97
129
|
},
|
|
130
|
+
transformIgnorePatterns: [
|
|
131
|
+
"[/\\\\]node_modules[/\\\\](?!@cedarjs[/\\\\]context[/\\\\])(?!@cedarjs[/\\\\]api[/\\\\])(?!@cedarjs[/\\\\]graphql-server[/\\\\])(?!@cedarjs[/\\\\]storage[/\\\\])"
|
|
132
|
+
],
|
|
98
133
|
testPathIgnorePatterns: [".scenarios.[jt]s$"]
|
|
99
134
|
};
|
|
100
135
|
var jest_preset_default = config;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"babel-plugin-redwood-cell.d.ts","sourceRoot":"","sources":["../../../../../src/config/jest/babelPlugins/babel-plugin-redwood-cell.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,KAAK,KAAK,CAAC,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"babel-plugin-redwood-cell.d.ts","sourceRoot":"","sources":["../../../../../src/config/jest/babelPlugins/babel-plugin-redwood-cell.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,KAAK,KAAK,CAAC,MAAM,cAAc,CAAA;AAsCtC,UAAU,WAAY,SAAQ,UAAU;IAKtC,WAAW,EAAE,MAAM,EAAE,CAAA;IACrB,gBAAgB,EAAE,OAAO,CAAA;CAC1B;AAED,MAAM,CAAC,OAAO,WAAW,EACvB,KAAK,GACN,EAAE;IACD,KAAK,EAAE,OAAO,CAAC,CAAA;CAChB,GAAG,SAAS,CAAC,WAAW,CAAC,CAoHzB"}
|
|
@@ -25,6 +25,7 @@ var import_node_path = require("node:path");
|
|
|
25
25
|
const EXPECTED_EXPORTS_FROM_CELL = [
|
|
26
26
|
"beforeQuery",
|
|
27
27
|
"QUERY",
|
|
28
|
+
"FRAGMENT",
|
|
28
29
|
"data",
|
|
29
30
|
"isEmpty",
|
|
30
31
|
"afterQuery",
|
|
@@ -70,7 +71,7 @@ function babel_plugin_redwood_cell_default({
|
|
|
70
71
|
state.hasDefaultExport = false;
|
|
71
72
|
},
|
|
72
73
|
exit(path, state) {
|
|
73
|
-
const hasQueryOrDataExport = state.exportNames.includes("QUERY") || state.exportNames.includes("data");
|
|
74
|
+
const hasQueryOrDataExport = state.exportNames.includes("QUERY") || state.exportNames.includes("FRAGMENT") || state.exportNames.includes("data");
|
|
74
75
|
if (state.hasDefaultExport || !hasQueryOrDataExport) {
|
|
75
76
|
return;
|
|
76
77
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
declare class RedwoodWebJestEnvironment extends
|
|
1
|
+
import JSDOMEnvironment from 'jest-fixed-jsdom';
|
|
2
|
+
declare class RedwoodWebJestEnvironment extends JSDOMEnvironment {
|
|
3
3
|
setup(): Promise<void>;
|
|
4
4
|
}
|
|
5
5
|
export default RedwoodWebJestEnvironment;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RedwoodWebJestEnv.d.ts","sourceRoot":"","sources":["../../../../../src/config/jest/web/RedwoodWebJestEnv.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RedwoodWebJestEnv.d.ts","sourceRoot":"","sources":["../../../../../src/config/jest/web/RedwoodWebJestEnv.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,kBAAkB,CAAA;AAkB/C,cAAM,yBAA0B,SAAQ,gBAAgB;IAChD,KAAK;CASZ;AAED,eAAe,yBAAyB,CAAA"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,21 +17,24 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
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
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
var RedwoodWebJestEnv_exports = {};
|
|
20
30
|
__export(RedwoodWebJestEnv_exports, {
|
|
21
31
|
default: () => RedwoodWebJestEnv_default
|
|
22
32
|
});
|
|
23
33
|
module.exports = __toCommonJS(RedwoodWebJestEnv_exports);
|
|
24
|
-
var
|
|
25
|
-
|
|
26
|
-
class RedwoodWebJestEnvironment extends import_jest_environment_jsdom.TestEnvironment {
|
|
34
|
+
var import_jest_fixed_jsdom = __toESM(require("jest-fixed-jsdom"), 1);
|
|
35
|
+
class RedwoodWebJestEnvironment extends import_jest_fixed_jsdom.default {
|
|
27
36
|
async setup() {
|
|
28
37
|
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
38
|
if (typeof this.global.crypto.subtle === "undefined") {
|
|
34
39
|
this.global.crypto.subtle = {};
|
|
35
40
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jest-preset.d.ts","sourceRoot":"","sources":["../../../../../src/config/jest/web/jest-preset.ts"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -31,15 +31,68 @@ __export(jest_preset_exports, {
|
|
|
31
31
|
default: () => jest_preset_default
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(jest_preset_exports);
|
|
34
|
+
var import_node_fs = __toESM(require("node:fs"), 1);
|
|
34
35
|
var import_node_path = __toESM(require("node:path"), 1);
|
|
35
36
|
var import_project_config = require("@cedarjs/project-config");
|
|
36
37
|
const cedarPaths = (0, import_project_config.getPaths)();
|
|
37
|
-
const
|
|
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
|
+
}
|
|
38
88
|
const config = {
|
|
39
89
|
// To make sure other config option which depends on rootDir always
|
|
40
90
|
// use correct path, for example, coverageDirectory
|
|
41
91
|
rootDir: cedarPaths.base,
|
|
42
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
|
|
43
96
|
testEnvironment: import_node_path.default.join(__dirname, "./RedwoodWebJestEnv.js"),
|
|
44
97
|
displayName: {
|
|
45
98
|
color: "blueBright",
|
|
@@ -69,41 +122,78 @@ const config = {
|
|
|
69
122
|
],
|
|
70
123
|
setupFilesAfterEnv: [import_node_path.default.resolve(__dirname, "./jest.setup.js")],
|
|
71
124
|
moduleNameMapper: {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
"@cedarjs/testing/
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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
|
+
}),
|
|
97
158
|
"~__CEDAR__USER_ROUTES_FOR_MOCK": cedarPaths.web.routes,
|
|
98
159
|
"~__CEDAR__USER_AUTH_FOR_MOCK": import_node_path.default.join(cedarPaths.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
160
|
// Support for importing files with extensions (like you'd do in ESM projects)
|
|
104
161
|
"^(\\.{1,2}/.*)\\.js$": "$1"
|
|
105
162
|
},
|
|
106
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
|
+
],
|
|
107
197
|
"\\.[jt]sx?$": [
|
|
108
198
|
"babel-jest",
|
|
109
199
|
// When jest runs tests in parallel, it serializes the config before passing down options to babel
|
|
@@ -113,6 +203,21 @@ const config = {
|
|
|
113
203
|
}
|
|
114
204
|
]
|
|
115
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
|
+
],
|
|
116
221
|
resolver: import_node_path.default.resolve(__dirname, "./resolver.js"),
|
|
117
222
|
testPathIgnorePatterns: [".(stories|mock).[jt]sx?$"]
|
|
118
223
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jest.setup.d.ts","sourceRoot":"","sources":["../../../../../src/config/jest/web/jest.setup.ts"],"names":[],"mappings":"AAEA,OAAO,2BAA2B,CAAA;
|
|
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,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var import_jest_dom = require("@testing-library/jest-dom");
|
|
3
|
-
var import_whatwg_fetch = require("whatwg-fetch");
|
|
4
3
|
var import_findCellMocks = require("@cedarjs/testing/dist/cjs/web/findCellMocks.js");
|
|
5
4
|
var import_mockRequests = require("@cedarjs/testing/dist/cjs/web/mockRequests.js");
|
|
6
5
|
global.mockGraphQLQuery = import_mockRequests.mockGraphQLQuery;
|
|
@@ -5,7 +5,7 @@ import { getPaths } from "@cedarjs/project-config";
|
|
|
5
5
|
import { getPackageManager } from "@cedarjs/project-config/packageManager";
|
|
6
6
|
const CedarApiVitestEnvironment = {
|
|
7
7
|
name: "cedar-api",
|
|
8
|
-
|
|
8
|
+
viteEnvironment: "ssr",
|
|
9
9
|
async setup() {
|
|
10
10
|
if (process.env.SKIP_DB_PUSH === "1") {
|
|
11
11
|
return {
|
|
@@ -16,13 +16,13 @@ function cedarVitestApiConfigPlugin() {
|
|
|
16
16
|
},
|
|
17
17
|
test: {
|
|
18
18
|
environment: path.join(import.meta.dirname, "CedarApiVitestEnv.js"),
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
//
|
|
24
|
-
//
|
|
25
|
-
|
|
19
|
+
// All api test files share a single test database, so they can't
|
|
20
|
+
// run in parallel. In Vitest 3 project-level fileParallelism didn't
|
|
21
|
+
// work (https://github.com/vitest-dev/vitest/discussions/7416) and
|
|
22
|
+
// we used the now-removed `poolOptions: { forks: { singleFork:
|
|
23
|
+
// true } }` as a workaround. Vitest 4 removed `poolOptions` and
|
|
24
|
+
// supports `fileParallelism` in project configs.
|
|
25
|
+
fileParallelism: false,
|
|
26
26
|
setupFiles: [path.join(import.meta.dirname, "vitest-api.setup.js")]
|
|
27
27
|
}
|
|
28
28
|
};
|
|
@@ -60,8 +60,8 @@ function buildScenario(itFunc) {
|
|
|
60
60
|
} else {
|
|
61
61
|
throw new Error("scenario() requires 2 or 3 arguments");
|
|
62
62
|
}
|
|
63
|
-
return itFunc(testName, async (
|
|
64
|
-
const testPath =
|
|
63
|
+
return itFunc(testName, async ({ task }) => {
|
|
64
|
+
const testPath = task.file.filepath;
|
|
65
65
|
const { scenario } = await loadScenarios(testPath, scenarioName);
|
|
66
66
|
const scenarioData = await seedScenario(scenario);
|
|
67
67
|
try {
|
|
@@ -89,8 +89,8 @@ function buildDescribeScenario(describeFunc) {
|
|
|
89
89
|
}
|
|
90
90
|
return describeFunc(describeBlockName, () => {
|
|
91
91
|
let scenarioData;
|
|
92
|
-
beforeAll(async (
|
|
93
|
-
const testPath =
|
|
92
|
+
beforeAll(async ({}, suite) => {
|
|
93
|
+
const testPath = suite.file.filepath;
|
|
94
94
|
const { scenario } = await loadScenarios(testPath, scenarioName);
|
|
95
95
|
scenarioData = await seedScenario(scenario);
|
|
96
96
|
});
|
|
@@ -38,7 +38,7 @@ var import_project_config = require("@cedarjs/project-config");
|
|
|
38
38
|
var import_packageManager = require("@cedarjs/project-config/packageManager");
|
|
39
39
|
const CedarApiVitestEnvironment = {
|
|
40
40
|
name: "cedar-api",
|
|
41
|
-
|
|
41
|
+
viteEnvironment: "ssr",
|
|
42
42
|
async setup() {
|
|
43
43
|
if (process.env.SKIP_DB_PUSH === "1") {
|
|
44
44
|
return {
|
|
@@ -50,13 +50,13 @@ function cedarVitestApiConfigPlugin() {
|
|
|
50
50
|
},
|
|
51
51
|
test: {
|
|
52
52
|
environment: import_node_path.default.join(import_meta.dirname, "CedarApiVitestEnv.js"),
|
|
53
|
-
//
|
|
54
|
-
//
|
|
55
|
-
//
|
|
56
|
-
//
|
|
57
|
-
//
|
|
58
|
-
//
|
|
59
|
-
|
|
53
|
+
// All api test files share a single test database, so they can't
|
|
54
|
+
// run in parallel. In Vitest 3 project-level fileParallelism didn't
|
|
55
|
+
// work (https://github.com/vitest-dev/vitest/discussions/7416) and
|
|
56
|
+
// we used the now-removed `poolOptions: { forks: { singleFork:
|
|
57
|
+
// true } }` as a workaround. Vitest 4 removed `poolOptions` and
|
|
58
|
+
// supports `fileParallelism` in project configs.
|
|
59
|
+
fileParallelism: false,
|
|
60
60
|
setupFiles: [import_node_path.default.join(import_meta.dirname, "vitest-api.setup.js")]
|
|
61
61
|
}
|
|
62
62
|
};
|
|
@@ -83,8 +83,8 @@ function buildScenario(itFunc) {
|
|
|
83
83
|
} else {
|
|
84
84
|
throw new Error("scenario() requires 2 or 3 arguments");
|
|
85
85
|
}
|
|
86
|
-
return itFunc(testName, async (
|
|
87
|
-
const testPath =
|
|
86
|
+
return itFunc(testName, async ({ task }) => {
|
|
87
|
+
const testPath = task.file.filepath;
|
|
88
88
|
const { scenario } = await loadScenarios(testPath, scenarioName);
|
|
89
89
|
const scenarioData = await seedScenario(scenario);
|
|
90
90
|
try {
|
|
@@ -112,8 +112,8 @@ function buildDescribeScenario(describeFunc) {
|
|
|
112
112
|
}
|
|
113
113
|
return describeFunc(describeBlockName, () => {
|
|
114
114
|
let scenarioData;
|
|
115
|
-
(0, import_vitest.beforeAll)(async (
|
|
116
|
-
const testPath =
|
|
115
|
+
(0, import_vitest.beforeAll)(async ({}, suite) => {
|
|
116
|
+
const testPath = suite.file.filepath;
|
|
117
117
|
const { scenario } = await loadScenarios(testPath, scenarioName);
|
|
118
118
|
scenarioData = await seedScenario(scenario);
|
|
119
119
|
});
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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"}
|
|
@@ -22,9 +22,7 @@ __export(apiBabelConfig_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(apiBabelConfig_exports);
|
|
24
24
|
var import_babel_config = require("@cedarjs/babel-config");
|
|
25
|
-
const { babelrc: _b, ...defaultBabelConfig } = (0, import_babel_config.getApiSideDefaultBabelConfig)(
|
|
26
|
-
forJest: true
|
|
27
|
-
});
|
|
25
|
+
const { babelrc: _b, ...defaultBabelConfig } = (0, import_babel_config.getApiSideDefaultBabelConfig)();
|
|
28
26
|
const config = {
|
|
29
27
|
...defaultBabelConfig,
|
|
30
28
|
plugins: (0, import_babel_config.getApiSideBabelPlugins)(),
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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"}
|
|
@@ -35,8 +35,17 @@ var import_node_path = __toESM(require("node:path"), 1);
|
|
|
35
35
|
var import_babel_config = require("@cedarjs/babel-config");
|
|
36
36
|
var import_project_config = require("@cedarjs/project-config");
|
|
37
37
|
const rwjsPaths = (0, import_project_config.getPaths)();
|
|
38
|
-
const
|
|
39
|
-
|
|
38
|
+
const { babelrc } = (0, import_babel_config.getApiSideDefaultBabelConfig)();
|
|
39
|
+
function resolveSubpath(specifier) {
|
|
40
|
+
try {
|
|
41
|
+
return require.resolve(specifier, {
|
|
42
|
+
paths: [rwjsPaths.api.base, rwjsPaths.base]
|
|
43
|
+
});
|
|
44
|
+
} catch {
|
|
45
|
+
return void 0;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const testingApiPath = resolveSubpath("@cedarjs/testing/api");
|
|
40
49
|
const config = {
|
|
41
50
|
// To make sure other config option which depends on rootDir use
|
|
42
51
|
// correct path, for example, coverageDirectory
|
|
@@ -77,11 +86,34 @@ const config = {
|
|
|
77
86
|
"^src/(.*)$": import_node_path.default.join(rwjsPaths.api.src, "$1"),
|
|
78
87
|
// @NOTE: Import @cedarjs/testing in api tests, and it automatically remaps to the api side only
|
|
79
88
|
// This is to prevent web stuff leaking into api, and vice versa
|
|
80
|
-
"^@cedarjs/testing$":
|
|
89
|
+
...testingApiPath ? { "^@cedarjs/testing$": testingApiPath } : {},
|
|
81
90
|
// Support for importing files with extensions (like you'd do in ESM projects)
|
|
82
91
|
"^(\\.{1,2}/.*)\\.js$": "$1"
|
|
83
92
|
},
|
|
84
93
|
transform: {
|
|
94
|
+
// `@cedarjs/context`, `@cedarjs/api`, `@cedarjs/graphql-server`, and
|
|
95
|
+
// `@cedarjs/storage` are ESM-only. Two things pull them in at the top
|
|
96
|
+
// level of a generated project's api-side test run: @cedarjs/testing's
|
|
97
|
+
// own api entry point (which virtually every test imports, for
|
|
98
|
+
// scenario/mock helpers — pulls in `@cedarjs/context` and
|
|
99
|
+
// `@cedarjs/graphql-server` via `directive.ts`, and
|
|
100
|
+
// `@cedarjs/api/webhooks` via `apiFunction.ts`), and the *user's own*
|
|
101
|
+
// generated code — the `cedar setup uploads` template imports
|
|
102
|
+
// `@cedarjs/storage`. Jest's CJS runtime can't parse the real ESM these
|
|
103
|
+
// now emit, so they need the same babel-jest carve-out the web preset
|
|
104
|
+
// already uses for ESM-only node_modules packages (see jest-preset.ts
|
|
105
|
+
// on the web side for the fuller explanation of why this is
|
|
106
|
+
// necessary).
|
|
107
|
+
"[/\\\\]node_modules[/\\\\]@cedarjs[/\\\\](context|api|graphql-server|storage)[/\\\\].+\\.js$": [
|
|
108
|
+
"babel-jest",
|
|
109
|
+
{
|
|
110
|
+
babelrc: false,
|
|
111
|
+
configFile: false,
|
|
112
|
+
presets: [
|
|
113
|
+
[require.resolve("@babel/preset-env"), { targets: { node: "20" } }]
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
],
|
|
85
117
|
"\\.[cm]?[jt]sx?$": [
|
|
86
118
|
"babel-jest",
|
|
87
119
|
// When jest runs tests in parallel, it serializes the config before passing down options to babel
|
|
@@ -95,6 +127,9 @@ const config = {
|
|
|
95
127
|
}
|
|
96
128
|
]
|
|
97
129
|
},
|
|
130
|
+
transformIgnorePatterns: [
|
|
131
|
+
"[/\\\\]node_modules[/\\\\](?!@cedarjs[/\\\\]context[/\\\\])(?!@cedarjs[/\\\\]api[/\\\\])(?!@cedarjs[/\\\\]graphql-server[/\\\\])(?!@cedarjs[/\\\\]storage[/\\\\])"
|
|
132
|
+
],
|
|
98
133
|
testPathIgnorePatterns: [".scenarios.[jt]s$"]
|
|
99
134
|
};
|
|
100
135
|
var jest_preset_default = config;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"babel-plugin-redwood-cell.d.ts","sourceRoot":"","sources":["../../../../../src/config/jest/babelPlugins/babel-plugin-redwood-cell.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,KAAK,KAAK,CAAC,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"babel-plugin-redwood-cell.d.ts","sourceRoot":"","sources":["../../../../../src/config/jest/babelPlugins/babel-plugin-redwood-cell.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,KAAK,KAAK,CAAC,MAAM,cAAc,CAAA;AAsCtC,UAAU,WAAY,SAAQ,UAAU;IAKtC,WAAW,EAAE,MAAM,EAAE,CAAA;IACrB,gBAAgB,EAAE,OAAO,CAAA;CAC1B;AAED,MAAM,CAAC,OAAO,WAAW,EACvB,KAAK,GACN,EAAE;IACD,KAAK,EAAE,OAAO,CAAC,CAAA;CAChB,GAAG,SAAS,CAAC,WAAW,CAAC,CAoHzB"}
|
|
@@ -25,6 +25,7 @@ var import_node_path = require("node:path");
|
|
|
25
25
|
const EXPECTED_EXPORTS_FROM_CELL = [
|
|
26
26
|
"beforeQuery",
|
|
27
27
|
"QUERY",
|
|
28
|
+
"FRAGMENT",
|
|
28
29
|
"data",
|
|
29
30
|
"isEmpty",
|
|
30
31
|
"afterQuery",
|
|
@@ -70,7 +71,7 @@ function babel_plugin_redwood_cell_default({
|
|
|
70
71
|
state.hasDefaultExport = false;
|
|
71
72
|
},
|
|
72
73
|
exit(path, state) {
|
|
73
|
-
const hasQueryOrDataExport = state.exportNames.includes("QUERY") || state.exportNames.includes("data");
|
|
74
|
+
const hasQueryOrDataExport = state.exportNames.includes("QUERY") || state.exportNames.includes("FRAGMENT") || state.exportNames.includes("data");
|
|
74
75
|
if (state.hasDefaultExport || !hasQueryOrDataExport) {
|
|
75
76
|
return;
|
|
76
77
|
}
|