@cedarjs/testing 5.0.4-next.167 → 5.0.4
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 +3 -1
- package/config/jest/api/jest-preset.d.ts.map +1 -1
- package/config/jest/api/jest-preset.js +3 -38
- package/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts.map +1 -1
- package/config/jest/babelPlugins/babel-plugin-redwood-cell.js +1 -2
- 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 +7 -12
- package/config/jest/web/jest-preset.d.ts.map +1 -1
- package/config/jest/web/jest-preset.js +30 -135
- package/config/jest/web/jest.setup.d.ts +1 -0
- package/config/jest/web/jest.setup.d.ts.map +1 -1
- package/config/jest/web/jest.setup.js +1 -0
- 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 +3 -1
- package/dist/cjs/config/jest/api/jest-preset.d.ts.map +1 -1
- package/dist/cjs/config/jest/api/jest-preset.js +3 -38
- 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 +1 -2
- 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 +7 -12
- package/dist/cjs/config/jest/web/jest-preset.d.ts.map +1 -1
- package/dist/cjs/config/jest/web/jest-preset.js +30 -135
- package/dist/cjs/config/jest/web/jest.setup.d.ts +1 -0
- package/dist/cjs/config/jest/web/jest.setup.d.ts.map +1 -1
- package/dist/cjs/config/jest/web/jest.setup.js +1 -0
- package/dist/cjs/web/MockProviders.js +3 -9
- package/dist/cjs/web/mockRequests.d.ts +18 -60
- package/dist/cjs/web/mockRequests.d.ts.map +1 -1
- package/dist/cjs/web/mockRequests.js +36 -107
- package/dist/cjs/web/vitest/index.d.ts +4 -0
- package/dist/cjs/web/vitest/index.d.ts.map +1 -0
- package/dist/cjs/web/vitest/index.js +0 -3
- package/dist/cjs/web/vitest/vite-plugin-auto-import.d.ts +2 -0
- package/dist/cjs/web/vitest/vite-plugin-auto-import.d.ts.map +1 -0
- package/dist/cjs/web/vitest/vite-plugin-cedarjs-router-import-transform.d.ts +7 -0
- package/dist/cjs/web/vitest/vite-plugin-cedarjs-router-import-transform.d.ts.map +1 -0
- package/dist/cjs/web/vitest/vite-plugin-create-auth-import-transform.d.ts +3 -0
- package/dist/cjs/web/vitest/vite-plugin-create-auth-import-transform.d.ts.map +1 -0
- package/dist/config/jest/api/apiBabelConfig.d.ts.map +1 -1
- package/dist/config/jest/api/apiBabelConfig.js +3 -1
- package/dist/config/jest/api/index.js +1 -5
- package/dist/config/jest/api/jest-preset.d.ts.map +1 -1
- package/dist/config/jest/api/jest-preset.js +3 -38
- package/dist/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts.map +1 -1
- package/dist/config/jest/babelPlugins/babel-plugin-redwood-cell.js +1 -2
- package/dist/config/jest/jest-serial-runner.js +1 -5
- 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 +7 -2
- package/dist/config/jest/web/index.js +1 -5
- package/dist/config/jest/web/jest-preset.d.ts.map +1 -1
- package/dist/config/jest/web/jest-preset.js +30 -135
- package/dist/config/jest/web/jest.setup.d.ts +1 -0
- package/dist/config/jest/web/jest.setup.d.ts.map +1 -1
- package/dist/config/jest/web/jest.setup.js +1 -0
- package/dist/config/jest/web/resolver.js +1 -5
- package/dist/web/MockProviders.js +3 -9
- package/dist/web/mockRequests.d.ts +18 -60
- package/dist/web/mockRequests.d.ts.map +1 -1
- package/dist/web/mockRequests.js +37 -108
- package/dist/web/vitest/index.d.ts +0 -1
- package/dist/web/vitest/index.d.ts.map +1 -1
- package/dist/web/vitest/index.js +0 -2
- package/package.json +21 -23
- package/config/jest/web/jest-fixed-jsdom.d.js +0 -1
- package/dist/cjs/config/jest/web/jest-fixed-jsdom.d.js +0 -1
- package/dist/cjs/web/vitest/vite-plugin-cedar-vitest-web-config.js +0 -51
- package/dist/cjs/web/vitest/vitest-web.setup.js +0 -19
- package/dist/config/jest/web/jest-fixed-jsdom.d.js +0 -0
- package/dist/web/vitest/vite-plugin-cedar-vitest-web-config.d.ts +0 -12
- package/dist/web/vitest/vite-plugin-cedar-vitest-web-config.d.ts.map +0 -1
- package/dist/web/vitest/vite-plugin-cedar-vitest-web-config.js +0 -16
- package/dist/web/vitest/vitest-web.setup.d.ts +0 -2
- package/dist/web/vitest/vitest-web.setup.d.ts.map +0 -1
- package/dist/web/vitest/vitest-web.setup.js +0 -18
|
@@ -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;AAS9B,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,7 +22,9 @@ __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)(
|
|
25
|
+
const { babelrc: _b, ...defaultBabelConfig } = (0, import_babel_config.getApiSideDefaultBabelConfig)({
|
|
26
|
+
forJest: true
|
|
27
|
+
});
|
|
26
28
|
const config = {
|
|
27
29
|
...defaultBabelConfig,
|
|
28
30
|
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;AASlC,QAAA,MAAM,MAAM,EAAE,MA0Db,CAAA;AAED,eAAe,MAAM,CAAA"}
|
|
@@ -35,17 +35,8 @@ 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
|
-
|
|
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");
|
|
38
|
+
const NODE_MODULES_PATH = import_node_path.default.join(rwjsPaths.base, "node_modules");
|
|
39
|
+
const { babelrc } = (0, import_babel_config.getApiSideDefaultBabelConfig)({ forJest: true });
|
|
49
40
|
const config = {
|
|
50
41
|
// To make sure other config option which depends on rootDir use
|
|
51
42
|
// correct path, for example, coverageDirectory
|
|
@@ -86,34 +77,11 @@ const config = {
|
|
|
86
77
|
"^src/(.*)$": import_node_path.default.join(rwjsPaths.api.src, "$1"),
|
|
87
78
|
// @NOTE: Import @cedarjs/testing in api tests, and it automatically remaps to the api side only
|
|
88
79
|
// This is to prevent web stuff leaking into api, and vice versa
|
|
89
|
-
|
|
80
|
+
"^@cedarjs/testing$": import_node_path.default.join(NODE_MODULES_PATH, "@cedarjs/testing/api"),
|
|
90
81
|
// Support for importing files with extensions (like you'd do in ESM projects)
|
|
91
82
|
"^(\\.{1,2}/.*)\\.js$": "$1"
|
|
92
83
|
},
|
|
93
84
|
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
|
-
],
|
|
117
85
|
"\\.[cm]?[jt]sx?$": [
|
|
118
86
|
"babel-jest",
|
|
119
87
|
// When jest runs tests in parallel, it serializes the config before passing down options to babel
|
|
@@ -127,9 +95,6 @@ const config = {
|
|
|
127
95
|
}
|
|
128
96
|
]
|
|
129
97
|
},
|
|
130
|
-
transformIgnorePatterns: [
|
|
131
|
-
"[/\\\\]node_modules[/\\\\](?!@cedarjs[/\\\\]context[/\\\\])(?!@cedarjs[/\\\\]api[/\\\\])(?!@cedarjs[/\\\\]graphql-server[/\\\\])(?!@cedarjs[/\\\\]storage[/\\\\])"
|
|
132
|
-
],
|
|
133
98
|
testPathIgnorePatterns: [".scenarios.[jt]s$"]
|
|
134
99
|
};
|
|
135
100
|
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;AAqCtC,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,CAkHzB"}
|
|
@@ -25,7 +25,6 @@ var import_node_path = require("node:path");
|
|
|
25
25
|
const EXPECTED_EXPORTS_FROM_CELL = [
|
|
26
26
|
"beforeQuery",
|
|
27
27
|
"QUERY",
|
|
28
|
-
"FRAGMENT",
|
|
29
28
|
"data",
|
|
30
29
|
"isEmpty",
|
|
31
30
|
"afterQuery",
|
|
@@ -71,7 +70,7 @@ function babel_plugin_redwood_cell_default({
|
|
|
71
70
|
state.hasDefaultExport = false;
|
|
72
71
|
},
|
|
73
72
|
exit(path, state) {
|
|
74
|
-
const hasQueryOrDataExport = state.exportNames.includes("QUERY") || state.exportNames.includes("
|
|
73
|
+
const hasQueryOrDataExport = state.exportNames.includes("QUERY") || state.exportNames.includes("data");
|
|
75
74
|
if (state.hasDefaultExport || !hasQueryOrDataExport) {
|
|
76
75
|
return;
|
|
77
76
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
declare class RedwoodWebJestEnvironment extends
|
|
1
|
+
import { TestEnvironment } from 'jest-environment-jsdom';
|
|
2
|
+
declare class RedwoodWebJestEnvironment extends TestEnvironment {
|
|
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":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAIxD,cAAM,yBAA0B,SAAQ,eAAe;IAC/C,KAAK;CAaZ;AAED,eAAe,yBAAyB,CAAA"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,24 +15,21 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
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
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
var RedwoodWebJestEnv_exports = {};
|
|
30
20
|
__export(RedwoodWebJestEnv_exports, {
|
|
31
21
|
default: () => RedwoodWebJestEnv_default
|
|
32
22
|
});
|
|
33
23
|
module.exports = __toCommonJS(RedwoodWebJestEnv_exports);
|
|
34
|
-
var
|
|
35
|
-
|
|
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 {
|
|
36
27
|
async setup() {
|
|
37
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
|
+
}
|
|
38
33
|
if (typeof this.global.crypto.subtle === "undefined") {
|
|
39
34
|
this.global.crypto.subtle = {};
|
|
40
35
|
}
|
|
@@ -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":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAOlC,QAAA,MAAM,MAAM,EAAE,MAkFb,CAAA;AAED,eAAe,MAAM,CAAA"}
|
|
@@ -31,68 +31,15 @@ __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);
|
|
35
34
|
var import_node_path = __toESM(require("node:path"), 1);
|
|
36
35
|
var import_project_config = require("@cedarjs/project-config");
|
|
37
36
|
const cedarPaths = (0, import_project_config.getPaths)();
|
|
38
|
-
const
|
|
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
|
-
}
|
|
37
|
+
const NODE_MODULES_PATH = import_node_path.default.join(cedarPaths.base, "node_modules");
|
|
88
38
|
const config = {
|
|
89
39
|
// To make sure other config option which depends on rootDir always
|
|
90
40
|
// use correct path, for example, coverageDirectory
|
|
91
41
|
rootDir: cedarPaths.base,
|
|
92
42
|
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
43
|
testEnvironment: import_node_path.default.join(__dirname, "./RedwoodWebJestEnv.js"),
|
|
97
44
|
displayName: {
|
|
98
45
|
color: "blueBright",
|
|
@@ -122,78 +69,41 @@ const config = {
|
|
|
122
69
|
],
|
|
123
70
|
setupFilesAfterEnv: [import_node_path.default.resolve(__dirname, "./jest.setup.js")],
|
|
124
71
|
moduleNameMapper: {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
"
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
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
|
-
}),
|
|
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"),
|
|
158
97
|
"~__CEDAR__USER_ROUTES_FOR_MOCK": cedarPaths.web.routes,
|
|
159
98
|
"~__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",
|
|
160
103
|
// Support for importing files with extensions (like you'd do in ESM projects)
|
|
161
104
|
"^(\\.{1,2}/.*)\\.js$": "$1"
|
|
162
105
|
},
|
|
163
106
|
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
107
|
"\\.[jt]sx?$": [
|
|
198
108
|
"babel-jest",
|
|
199
109
|
// When jest runs tests in parallel, it serializes the config before passing down options to babel
|
|
@@ -203,21 +113,6 @@ const config = {
|
|
|
203
113
|
}
|
|
204
114
|
]
|
|
205
115
|
},
|
|
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
116
|
resolver: import_node_path.default.resolve(__dirname, "./resolver.js"),
|
|
222
117
|
testPathIgnorePatterns: [".(stories|mock).[jt]sx?$"]
|
|
223
118
|
};
|
|
@@ -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;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,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var import_jest_dom = require("@testing-library/jest-dom");
|
|
3
|
+
var import_whatwg_fetch = require("whatwg-fetch");
|
|
3
4
|
var import_findCellMocks = require("@cedarjs/testing/dist/cjs/web/findCellMocks.js");
|
|
4
5
|
var import_mockRequests = require("@cedarjs/testing/dist/cjs/web/mockRequests.js");
|
|
5
6
|
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
|
+
transformMode: "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
|
+
// fileParallelism: false,
|
|
20
|
+
// fileParallelism doesn't work with vitest projects (which is what
|
|
21
|
+
// we're using in the root vitest.config.ts). As a workaround we set
|
|
22
|
+
// poolOptions instead, which also shouldn't work, but was suggested
|
|
23
|
+
// by Vitest team member AriPerkkio (Hiroshi's answer didn't work).
|
|
24
|
+
// https://github.com/vitest-dev/vitest/discussions/7416
|
|
25
|
+
poolOptions: { forks: { singleFork: true } },
|
|
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 = task.file.filepath;
|
|
63
|
+
return itFunc(testName, async (ctx) => {
|
|
64
|
+
const testPath = ctx.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 (ctx) => {
|
|
93
|
+
const testPath = ctx.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
|
+
transformMode: "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
|
+
// fileParallelism: false,
|
|
54
|
+
// fileParallelism doesn't work with vitest projects (which is what
|
|
55
|
+
// we're using in the root vitest.config.ts). As a workaround we set
|
|
56
|
+
// poolOptions instead, which also shouldn't work, but was suggested
|
|
57
|
+
// by Vitest team member AriPerkkio (Hiroshi's answer didn't work).
|
|
58
|
+
// https://github.com/vitest-dev/vitest/discussions/7416
|
|
59
|
+
poolOptions: { forks: { singleFork: true } },
|
|
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 = task.file.filepath;
|
|
86
|
+
return itFunc(testName, async (ctx) => {
|
|
87
|
+
const testPath = ctx.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 (ctx) => {
|
|
116
|
+
const testPath = ctx.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;AAS9B,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,7 +22,9 @@ __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)(
|
|
25
|
+
const { babelrc: _b, ...defaultBabelConfig } = (0, import_babel_config.getApiSideDefaultBabelConfig)({
|
|
26
|
+
forJest: true
|
|
27
|
+
});
|
|
26
28
|
const config = {
|
|
27
29
|
...defaultBabelConfig,
|
|
28
30
|
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;AASlC,QAAA,MAAM,MAAM,EAAE,MA0Db,CAAA;AAED,eAAe,MAAM,CAAA"}
|
|
@@ -35,17 +35,8 @@ 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
|
-
|
|
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");
|
|
38
|
+
const NODE_MODULES_PATH = import_node_path.default.join(rwjsPaths.base, "node_modules");
|
|
39
|
+
const { babelrc } = (0, import_babel_config.getApiSideDefaultBabelConfig)({ forJest: true });
|
|
49
40
|
const config = {
|
|
50
41
|
// To make sure other config option which depends on rootDir use
|
|
51
42
|
// correct path, for example, coverageDirectory
|
|
@@ -86,34 +77,11 @@ const config = {
|
|
|
86
77
|
"^src/(.*)$": import_node_path.default.join(rwjsPaths.api.src, "$1"),
|
|
87
78
|
// @NOTE: Import @cedarjs/testing in api tests, and it automatically remaps to the api side only
|
|
88
79
|
// This is to prevent web stuff leaking into api, and vice versa
|
|
89
|
-
|
|
80
|
+
"^@cedarjs/testing$": import_node_path.default.join(NODE_MODULES_PATH, "@cedarjs/testing/api"),
|
|
90
81
|
// Support for importing files with extensions (like you'd do in ESM projects)
|
|
91
82
|
"^(\\.{1,2}/.*)\\.js$": "$1"
|
|
92
83
|
},
|
|
93
84
|
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
|
-
],
|
|
117
85
|
"\\.[cm]?[jt]sx?$": [
|
|
118
86
|
"babel-jest",
|
|
119
87
|
// When jest runs tests in parallel, it serializes the config before passing down options to babel
|
|
@@ -127,9 +95,6 @@ const config = {
|
|
|
127
95
|
}
|
|
128
96
|
]
|
|
129
97
|
},
|
|
130
|
-
transformIgnorePatterns: [
|
|
131
|
-
"[/\\\\]node_modules[/\\\\](?!@cedarjs[/\\\\]context[/\\\\])(?!@cedarjs[/\\\\]api[/\\\\])(?!@cedarjs[/\\\\]graphql-server[/\\\\])(?!@cedarjs[/\\\\]storage[/\\\\])"
|
|
132
|
-
],
|
|
133
98
|
testPathIgnorePatterns: [".scenarios.[jt]s$"]
|
|
134
99
|
};
|
|
135
100
|
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;AAqCtC,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,CAkHzB"}
|
|
@@ -25,7 +25,6 @@ var import_node_path = require("node:path");
|
|
|
25
25
|
const EXPECTED_EXPORTS_FROM_CELL = [
|
|
26
26
|
"beforeQuery",
|
|
27
27
|
"QUERY",
|
|
28
|
-
"FRAGMENT",
|
|
29
28
|
"data",
|
|
30
29
|
"isEmpty",
|
|
31
30
|
"afterQuery",
|
|
@@ -71,7 +70,7 @@ function babel_plugin_redwood_cell_default({
|
|
|
71
70
|
state.hasDefaultExport = false;
|
|
72
71
|
},
|
|
73
72
|
exit(path, state) {
|
|
74
|
-
const hasQueryOrDataExport = state.exportNames.includes("QUERY") || state.exportNames.includes("
|
|
73
|
+
const hasQueryOrDataExport = state.exportNames.includes("QUERY") || state.exportNames.includes("data");
|
|
75
74
|
if (state.hasDefaultExport || !hasQueryOrDataExport) {
|
|
76
75
|
return;
|
|
77
76
|
}
|