@cedarjs/testing 6.0.2 → 6.0.3-next.227
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/dist/api/checkTestDatabase.d.ts +27 -0
- package/dist/api/checkTestDatabase.d.ts.map +1 -1
- package/dist/api/checkTestDatabase.js +102 -0
- package/dist/api/mockContext.d.ts +1 -1
- package/dist/api/mockContext.d.ts.map +1 -1
- package/dist/api/vitest/CedarApiVitestEnv.d.ts.map +1 -1
- package/dist/api/vitest/CedarApiVitestEnv.js +14 -2
- package/dist/api/vitest/teardown.d.ts +18 -0
- package/dist/api/vitest/teardown.d.ts.map +1 -0
- package/dist/api/vitest/teardown.js +43 -0
- package/dist/api/vitest/vite-plugin-cedar-vitest-api-config.d.ts.map +1 -1
- package/dist/api/vitest/vite-plugin-cedar-vitest-api-config.js +6 -1
- package/dist/api/vitest/vitest-api.setup.d.ts.map +1 -1
- package/dist/api/vitest/vitest-api.setup.js +9 -22
- package/dist/web/MockParamsProvider.d.ts.map +1 -1
- package/dist/web/MockParamsProvider.js +10 -1
- package/dist/web/MockRouter.d.ts.map +1 -1
- package/dist/web/mockRequests.d.ts +14 -0
- package/dist/web/mockRequests.d.ts.map +1 -1
- package/dist/web/mockRequests.js +8 -0
- package/package.json +22 -95
- package/config/jest/api/RedwoodApiJestEnv.d.ts +0 -11
- package/config/jest/api/RedwoodApiJestEnv.d.ts.map +0 -1
- package/config/jest/api/RedwoodApiJestEnv.js +0 -48
- package/config/jest/api/apiBabelConfig.d.ts +0 -5
- package/config/jest/api/apiBabelConfig.d.ts.map +0 -1
- package/config/jest/api/apiBabelConfig.js +0 -34
- package/config/jest/api/globalSetup.d.ts +0 -3
- package/config/jest/api/globalSetup.d.ts.map +0 -1
- package/config/jest/api/globalSetup.js +0 -63
- package/config/jest/api/index.d.ts +0 -3
- package/config/jest/api/index.d.ts.map +0 -1
- package/config/jest/api/index.js +0 -25
- package/config/jest/api/jest-preset.d.ts +0 -4
- package/config/jest/api/jest-preset.d.ts.map +0 -1
- package/config/jest/api/jest-preset.js +0 -140
- package/config/jest/api/jest.setup.d.ts +0 -2
- package/config/jest/api/jest.setup.d.ts.map +0 -1
- package/config/jest/api/jest.setup.js +0 -267
- package/config/jest/api/package.json +0 -8
- package/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts +0 -11
- package/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts.map +0 -1
- package/config/jest/babelPlugins/babel-plugin-redwood-cell.js +0 -122
- package/config/jest/jest-serial-runner.d.ts +0 -8
- package/config/jest/jest-serial-runner.d.ts.map +0 -1
- package/config/jest/jest-serial-runner.js +0 -37
- package/config/jest/web/RedwoodWebJestEnv.d.ts +0 -6
- package/config/jest/web/RedwoodWebJestEnv.d.ts.map +0 -1
- package/config/jest/web/RedwoodWebJestEnv.js +0 -43
- package/config/jest/web/index.d.ts +0 -3
- package/config/jest/web/index.d.ts.map +0 -1
- package/config/jest/web/index.js +0 -25
- package/config/jest/web/jest-fixed-jsdom.d.js +0 -1
- package/config/jest/web/jest-preset.d.ts +0 -4
- package/config/jest/web/jest-preset.d.ts.map +0 -1
- package/config/jest/web/jest-preset.js +0 -224
- package/config/jest/web/jest.setup.d.ts +0 -7
- package/config/jest/web/jest.setup.d.ts.map +0 -1
- package/config/jest/web/jest.setup.js +0 -21
- package/config/jest/web/package.json +0 -8
- package/config/jest/web/resolver.d.ts +0 -4
- package/config/jest/web/resolver.d.ts.map +0 -1
- package/config/jest/web/resolver.js +0 -30
- package/config/jest/web/webBabelConfig.d.ts +0 -10
- package/config/jest/web/webBabelConfig.d.ts.map +0 -1
- package/config/jest/web/webBabelConfig.js +0 -48
- package/config/package.json +0 -1
- package/dist/cjs/api/apiFunction.d.ts +0 -37
- package/dist/cjs/api/apiFunction.d.ts.map +0 -1
- package/dist/cjs/api/apiFunction.js +0 -89
- package/dist/cjs/api/checkTestDatabase.d.ts +0 -23
- package/dist/cjs/api/checkTestDatabase.d.ts.map +0 -1
- package/dist/cjs/api/checkTestDatabase.js +0 -69
- package/dist/cjs/api/directive.d.ts +0 -51
- package/dist/cjs/api/directive.d.ts.map +0 -1
- package/dist/cjs/api/directive.js +0 -77
- package/dist/cjs/api/index.d.ts +0 -4
- package/dist/cjs/api/index.d.ts.map +0 -1
- package/dist/cjs/api/index.js +0 -26
- package/dist/cjs/api/mockContext.d.ts +0 -5
- package/dist/cjs/api/mockContext.d.ts.map +0 -1
- package/dist/cjs/api/mockContext.js +0 -58
- package/dist/cjs/api/scenario.d.ts +0 -108
- package/dist/cjs/api/scenario.d.ts.map +0 -1
- package/dist/cjs/api/scenario.js +0 -30
- package/dist/cjs/api/vitest/CedarApiVitestEnv.js +0 -75
- package/dist/cjs/api/vitest/index.js +0 -34
- package/dist/cjs/api/vitest/vite-plugin-auto-import.js +0 -71
- package/dist/cjs/api/vitest/vite-plugin-cedar-vitest-api-config.js +0 -69
- package/dist/cjs/api/vitest/vite-plugin-track-db-imports.js +0 -47
- package/dist/cjs/api/vitest/vitest-api.setup.js +0 -270
- package/dist/cjs/cache/index.d.ts +0 -50
- package/dist/cjs/cache/index.d.ts.map +0 -1
- package/dist/cjs/cache/index.js +0 -104
- package/dist/cjs/config/jest/api/RedwoodApiJestEnv.d.ts +0 -11
- package/dist/cjs/config/jest/api/RedwoodApiJestEnv.d.ts.map +0 -1
- package/dist/cjs/config/jest/api/RedwoodApiJestEnv.js +0 -48
- package/dist/cjs/config/jest/api/apiBabelConfig.d.ts +0 -5
- package/dist/cjs/config/jest/api/apiBabelConfig.d.ts.map +0 -1
- package/dist/cjs/config/jest/api/apiBabelConfig.js +0 -34
- package/dist/cjs/config/jest/api/globalSetup.d.ts +0 -3
- package/dist/cjs/config/jest/api/globalSetup.d.ts.map +0 -1
- package/dist/cjs/config/jest/api/globalSetup.js +0 -63
- package/dist/cjs/config/jest/api/index.d.ts +0 -3
- package/dist/cjs/config/jest/api/index.d.ts.map +0 -1
- package/dist/cjs/config/jest/api/index.js +0 -25
- package/dist/cjs/config/jest/api/jest-preset.d.ts +0 -4
- package/dist/cjs/config/jest/api/jest-preset.d.ts.map +0 -1
- package/dist/cjs/config/jest/api/jest-preset.js +0 -140
- package/dist/cjs/config/jest/api/jest.setup.d.ts +0 -2
- package/dist/cjs/config/jest/api/jest.setup.d.ts.map +0 -1
- package/dist/cjs/config/jest/api/jest.setup.js +0 -267
- package/dist/cjs/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts +0 -11
- package/dist/cjs/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts.map +0 -1
- package/dist/cjs/config/jest/babelPlugins/babel-plugin-redwood-cell.js +0 -122
- package/dist/cjs/config/jest/jest-serial-runner.d.ts +0 -8
- package/dist/cjs/config/jest/jest-serial-runner.d.ts.map +0 -1
- package/dist/cjs/config/jest/jest-serial-runner.js +0 -37
- package/dist/cjs/config/jest/web/RedwoodWebJestEnv.d.ts +0 -6
- package/dist/cjs/config/jest/web/RedwoodWebJestEnv.d.ts.map +0 -1
- package/dist/cjs/config/jest/web/RedwoodWebJestEnv.js +0 -43
- package/dist/cjs/config/jest/web/index.d.ts +0 -3
- package/dist/cjs/config/jest/web/index.d.ts.map +0 -1
- package/dist/cjs/config/jest/web/index.js +0 -25
- package/dist/cjs/config/jest/web/jest-fixed-jsdom.d.js +0 -1
- package/dist/cjs/config/jest/web/jest-preset.d.ts +0 -4
- package/dist/cjs/config/jest/web/jest-preset.d.ts.map +0 -1
- package/dist/cjs/config/jest/web/jest-preset.js +0 -224
- package/dist/cjs/config/jest/web/jest.setup.d.ts +0 -7
- package/dist/cjs/config/jest/web/jest.setup.d.ts.map +0 -1
- package/dist/cjs/config/jest/web/jest.setup.js +0 -21
- package/dist/cjs/config/jest/web/resolver.d.ts +0 -4
- package/dist/cjs/config/jest/web/resolver.d.ts.map +0 -1
- package/dist/cjs/config/jest/web/resolver.js +0 -30
- package/dist/cjs/config/jest/web/webBabelConfig.d.ts +0 -10
- package/dist/cjs/config/jest/web/webBabelConfig.d.ts.map +0 -1
- package/dist/cjs/config/jest/web/webBabelConfig.js +0 -48
- package/dist/cjs/package.json +0 -1
- package/dist/cjs/web/MockParamsProvider.d.ts +0 -7
- package/dist/cjs/web/MockParamsProvider.d.ts.map +0 -1
- package/dist/cjs/web/MockParamsProvider.js +0 -44
- package/dist/cjs/web/MockProviders.d.ts +0 -5
- package/dist/cjs/web/MockProviders.d.ts.map +0 -1
- package/dist/cjs/web/MockProviders.js +0 -66
- package/dist/cjs/web/MockRouter.d.ts +0 -11
- package/dist/cjs/web/MockRouter.d.ts.map +0 -1
- package/dist/cjs/web/MockRouter.js +0 -48
- package/dist/cjs/web/customRender.d.ts +0 -6
- package/dist/cjs/web/customRender.d.ts.map +0 -1
- package/dist/cjs/web/customRender.js +0 -54
- package/dist/cjs/web/fileMock.d.ts +0 -10
- package/dist/cjs/web/fileMock.d.ts.map +0 -1
- package/dist/cjs/web/fileMock.js +0 -24
- package/dist/cjs/web/findCellMocks.d.ts +0 -2
- package/dist/cjs/web/findCellMocks.d.ts.map +0 -1
- package/dist/cjs/web/findCellMocks.js +0 -45
- package/dist/cjs/web/globRoutesImporter.d.ts +0 -13
- package/dist/cjs/web/globRoutesImporter.d.ts.map +0 -1
- package/dist/cjs/web/globRoutesImporter.js +0 -46
- package/dist/cjs/web/global.d.ts +0 -6
- package/dist/cjs/web/global.d.ts.map +0 -1
- package/dist/cjs/web/global.js +0 -1
- package/dist/cjs/web/index.d.ts +0 -6
- package/dist/cjs/web/index.d.ts.map +0 -1
- package/dist/cjs/web/index.js +0 -41
- package/dist/cjs/web/mockAuth.d.ts +0 -29
- package/dist/cjs/web/mockAuth.d.ts.map +0 -1
- package/dist/cjs/web/mockAuth.js +0 -89
- package/dist/cjs/web/mockRequests.d.ts +0 -72
- package/dist/cjs/web/mockRequests.d.ts.map +0 -1
- package/dist/cjs/web/mockRequests.js +0 -210
- package/dist/cjs/web/vitest/index.js +0 -37
- package/dist/cjs/web/vitest/vite-plugin-auto-import.js +0 -60
- package/dist/cjs/web/vitest/vite-plugin-cedar-vitest-web-config.js +0 -51
- package/dist/cjs/web/vitest/vite-plugin-cedarjs-router-import-transform.js +0 -42
- package/dist/cjs/web/vitest/vite-plugin-create-auth-import-transform.js +0 -43
- package/dist/cjs/web/vitest/vitest-web.setup.js +0 -19
- package/dist/config/jest/api/RedwoodApiJestEnv.d.ts +0 -11
- package/dist/config/jest/api/RedwoodApiJestEnv.d.ts.map +0 -1
- package/dist/config/jest/api/RedwoodApiJestEnv.js +0 -28
- package/dist/config/jest/api/apiBabelConfig.d.ts +0 -5
- package/dist/config/jest/api/apiBabelConfig.d.ts.map +0 -1
- package/dist/config/jest/api/apiBabelConfig.js +0 -18
- package/dist/config/jest/api/globalSetup.d.ts +0 -3
- package/dist/config/jest/api/globalSetup.d.ts.map +0 -1
- package/dist/config/jest/api/globalSetup.js +0 -36
- package/dist/config/jest/api/index.d.ts +0 -3
- package/dist/config/jest/api/index.d.ts.map +0 -1
- package/dist/config/jest/api/index.js +0 -15
- package/dist/config/jest/api/jest-preset.d.ts +0 -4
- package/dist/config/jest/api/jest-preset.d.ts.map +0 -1
- package/dist/config/jest/api/jest-preset.js +0 -110
- package/dist/config/jest/api/jest.setup.d.ts +0 -2
- package/dist/config/jest/api/jest.setup.d.ts.map +0 -1
- package/dist/config/jest/api/jest.setup.js +0 -244
- package/dist/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts +0 -11
- package/dist/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts.map +0 -1
- package/dist/config/jest/babelPlugins/babel-plugin-redwood-cell.js +0 -102
- package/dist/config/jest/jest-serial-runner.d.ts +0 -8
- package/dist/config/jest/jest-serial-runner.d.ts.map +0 -1
- package/dist/config/jest/jest-serial-runner.js +0 -27
- package/dist/config/jest/web/RedwoodWebJestEnv.d.ts +0 -6
- package/dist/config/jest/web/RedwoodWebJestEnv.d.ts.map +0 -1
- package/dist/config/jest/web/RedwoodWebJestEnv.js +0 -13
- package/dist/config/jest/web/index.d.ts +0 -3
- package/dist/config/jest/web/index.d.ts.map +0 -1
- package/dist/config/jest/web/index.js +0 -15
- package/dist/config/jest/web/jest-fixed-jsdom.d.js +0 -0
- package/dist/config/jest/web/jest-preset.d.ts +0 -4
- package/dist/config/jest/web/jest-preset.d.ts.map +0 -1
- package/dist/config/jest/web/jest-preset.js +0 -194
- package/dist/config/jest/web/jest.setup.d.ts +0 -7
- package/dist/config/jest/web/jest.setup.d.ts.map +0 -1
- package/dist/config/jest/web/jest.setup.js +0 -27
- package/dist/config/jest/web/resolver.d.ts +0 -4
- package/dist/config/jest/web/resolver.d.ts.map +0 -1
- package/dist/config/jest/web/resolver.js +0 -42
- package/dist/config/jest/web/webBabelConfig.d.ts +0 -10
- package/dist/config/jest/web/webBabelConfig.d.ts.map +0 -1
- package/dist/config/jest/web/webBabelConfig.js +0 -18
- package/dist/web/fileMock.d.ts +0 -10
- package/dist/web/fileMock.d.ts.map +0 -1
- package/dist/web/fileMock.js +0 -4
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var vite_plugin_auto_import_exports = {};
|
|
30
|
-
__export(vite_plugin_auto_import_exports, {
|
|
31
|
-
autoImportsPlugin: () => autoImportsPlugin
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(vite_plugin_auto_import_exports);
|
|
34
|
-
var import_vite = __toESM(require("unplugin-auto-import/vite"), 1);
|
|
35
|
-
function autoImportsPlugin() {
|
|
36
|
-
return (0, import_vite.default)({
|
|
37
|
-
// targets to transform
|
|
38
|
-
include: [
|
|
39
|
-
/\.[tj]sx?$/
|
|
40
|
-
// .ts, .tsx, .js, .jsx
|
|
41
|
-
],
|
|
42
|
-
// global imports to register
|
|
43
|
-
imports: [
|
|
44
|
-
{
|
|
45
|
-
"@cedarjs/testing/web": [
|
|
46
|
-
"mockGraphQLQuery",
|
|
47
|
-
"mockGraphQLMutation",
|
|
48
|
-
"mockCurrentUser"
|
|
49
|
-
]
|
|
50
|
-
}
|
|
51
|
-
],
|
|
52
|
-
// We provide our mocking types elsewhere and so don't need this plugin to
|
|
53
|
-
// generate them.
|
|
54
|
-
dts: false
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
58
|
-
0 && (module.exports = {
|
|
59
|
-
autoImportsPlugin
|
|
60
|
-
});
|
|
@@ -1,51 +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 vite_plugin_cedar_vitest_web_config_exports = {};
|
|
30
|
-
__export(vite_plugin_cedar_vitest_web_config_exports, {
|
|
31
|
-
cedarVitestWebConfigPlugin: () => cedarVitestWebConfigPlugin
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(vite_plugin_cedar_vitest_web_config_exports);
|
|
34
|
-
var import_node_path = __toESM(require("node:path"), 1);
|
|
35
|
-
const import_meta = {};
|
|
36
|
-
function cedarVitestWebConfigPlugin() {
|
|
37
|
-
return {
|
|
38
|
-
name: "cedar-vitest-web-config",
|
|
39
|
-
config: () => {
|
|
40
|
-
return {
|
|
41
|
-
test: {
|
|
42
|
-
setupFiles: [import_node_path.default.join(import_meta.dirname, "vitest-web.setup.js")]
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
-
0 && (module.exports = {
|
|
50
|
-
cedarVitestWebConfigPlugin
|
|
51
|
-
});
|
|
@@ -1,42 +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 vite_plugin_cedarjs_router_import_transform_exports = {};
|
|
20
|
-
__export(vite_plugin_cedarjs_router_import_transform_exports, {
|
|
21
|
-
cedarJsRouterImportTransformPlugin: () => cedarJsRouterImportTransformPlugin
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(vite_plugin_cedarjs_router_import_transform_exports);
|
|
24
|
-
function cedarJsRouterImportTransformPlugin() {
|
|
25
|
-
return {
|
|
26
|
-
name: "cedarjs-router-import-transform",
|
|
27
|
-
enforce: "pre",
|
|
28
|
-
transform(code, id) {
|
|
29
|
-
if (id.includes("/web/src")) {
|
|
30
|
-
code = code.replace(
|
|
31
|
-
/['"]@cedarjs\/router['"]/,
|
|
32
|
-
"'@cedarjs/testing/web/MockRouter.js'"
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
return code;
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
-
0 && (module.exports = {
|
|
41
|
-
cedarJsRouterImportTransformPlugin
|
|
42
|
-
});
|
|
@@ -1,43 +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 vite_plugin_create_auth_import_transform_exports = {};
|
|
20
|
-
__export(vite_plugin_create_auth_import_transform_exports, {
|
|
21
|
-
createAuthImportTransformPlugin: () => createAuthImportTransformPlugin
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(vite_plugin_create_auth_import_transform_exports);
|
|
24
|
-
function createAuthImportTransformPlugin() {
|
|
25
|
-
return {
|
|
26
|
-
name: "create-auth-import-transform",
|
|
27
|
-
enforce: "pre",
|
|
28
|
-
transform(code, id) {
|
|
29
|
-
if (id.endsWith("/web/src/auth.ts") || id.endsWith("/web/src/auth.js")) {
|
|
30
|
-
code = code.replace(
|
|
31
|
-
/(^\s*import\s*{[^}]*?)(\bcreateAuth\b)(,?)([^}]*})/m,
|
|
32
|
-
"$1$4"
|
|
33
|
-
);
|
|
34
|
-
code = "import { createAuthentication as createAuth } from '@cedarjs/testing/auth'\n" + code;
|
|
35
|
-
}
|
|
36
|
-
return code;
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
-
0 && (module.exports = {
|
|
42
|
-
createAuthImportTransformPlugin
|
|
43
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var import_vitest = require("vitest");
|
|
3
|
-
var import_project_config = require("@cedarjs/project-config");
|
|
4
|
-
var import_findCellMocks = require("../findCellMocks.js");
|
|
5
|
-
var import_mockRequests = require("../mockRequests.js");
|
|
6
|
-
(0, import_vitest.beforeAll)(async () => {
|
|
7
|
-
const cellMocks = (0, import_findCellMocks.findCellMocks)((0, import_project_config.getPaths)().web.src);
|
|
8
|
-
for (const m of cellMocks) {
|
|
9
|
-
await import(m);
|
|
10
|
-
}
|
|
11
|
-
await (0, import_mockRequests.startMSW)("node");
|
|
12
|
-
(0, import_mockRequests.setupRequestHandlers)();
|
|
13
|
-
});
|
|
14
|
-
(0, import_vitest.afterEach)(() => {
|
|
15
|
-
(0, import_mockRequests.setupRequestHandlers)();
|
|
16
|
-
});
|
|
17
|
-
(0, import_vitest.afterAll)(() => {
|
|
18
|
-
(0, import_mockRequests.closeServer)();
|
|
19
|
-
});
|
|
@@ -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,28 +0,0 @@
|
|
|
1
|
-
import { TestEnvironment } from "jest-environment-node";
|
|
2
|
-
class RedwoodApiJestEnvironment extends TestEnvironment {
|
|
3
|
-
testPath;
|
|
4
|
-
constructor(config, context) {
|
|
5
|
-
super(config, context);
|
|
6
|
-
this.testPath = context.testPath;
|
|
7
|
-
}
|
|
8
|
-
async setup() {
|
|
9
|
-
await super.setup();
|
|
10
|
-
this.global.testPath = this.testPath;
|
|
11
|
-
}
|
|
12
|
-
async teardown() {
|
|
13
|
-
await super.teardown();
|
|
14
|
-
}
|
|
15
|
-
getVmContext() {
|
|
16
|
-
return super.getVmContext();
|
|
17
|
-
}
|
|
18
|
-
// async handleTestEvent(event, state) {
|
|
19
|
-
// if (event.name === 'test_start') {
|
|
20
|
-
// // Link to event docs:
|
|
21
|
-
// // https://github.com/facebook/jest/blob/master/packages/jest-types/src/Circus.ts
|
|
22
|
-
// }
|
|
23
|
-
// }
|
|
24
|
-
}
|
|
25
|
-
var RedwoodApiJestEnv_default = RedwoodApiJestEnvironment;
|
|
26
|
-
export {
|
|
27
|
-
RedwoodApiJestEnv_default as default
|
|
28
|
-
};
|
|
@@ -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,18 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getApiSideDefaultBabelConfig,
|
|
3
|
-
getApiSideBabelPresets,
|
|
4
|
-
getApiSideBabelPlugins
|
|
5
|
-
} from "@cedarjs/babel-config";
|
|
6
|
-
const { babelrc: _b, ...defaultBabelConfig } = getApiSideDefaultBabelConfig();
|
|
7
|
-
const config = {
|
|
8
|
-
...defaultBabelConfig,
|
|
9
|
-
plugins: getApiSideBabelPlugins(),
|
|
10
|
-
presets: getApiSideBabelPresets({
|
|
11
|
-
presetEnv: true
|
|
12
|
-
// jest needs code transpiled
|
|
13
|
-
})
|
|
14
|
-
};
|
|
15
|
-
var apiBabelConfig_default = config;
|
|
16
|
-
export {
|
|
17
|
-
apiBabelConfig_default as default
|
|
18
|
-
};
|
|
@@ -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,36 +0,0 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
import "dotenv-defaults/config";
|
|
3
|
-
import execa from "execa";
|
|
4
|
-
import { getPaths } from "@cedarjs/project-config";
|
|
5
|
-
import { getPackageManager } from "@cedarjs/project-config/packageManager";
|
|
6
|
-
import {
|
|
7
|
-
checkTestDatabaseUrlMatchesProvider,
|
|
8
|
-
redactDatabaseUrl
|
|
9
|
-
} from "../../../api/checkTestDatabase.js";
|
|
10
|
-
async function globalSetup_default() {
|
|
11
|
-
if (process.env.SKIP_DB_PUSH === "1") {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
const cedarPaths = getPaths();
|
|
15
|
-
const defaultDb = `file:${path.join(cedarPaths.generated.base, "test.db")}`;
|
|
16
|
-
const usedFallback = !process.env.TEST_DATABASE_URL;
|
|
17
|
-
process.env.DATABASE_URL = process.env.TEST_DATABASE_URL || defaultDb;
|
|
18
|
-
await checkTestDatabaseUrlMatchesProvider(
|
|
19
|
-
process.env.DATABASE_URL,
|
|
20
|
-
usedFallback
|
|
21
|
-
);
|
|
22
|
-
console.log(
|
|
23
|
-
`Setting up test database: ${redactDatabaseUrl(process.env.DATABASE_URL)}`
|
|
24
|
-
);
|
|
25
|
-
const command = process.env.TEST_DATABASE_STRATEGY === "reset" ? ["prisma", "migrate", "reset", "--force"] : ["prisma", "db", "push", "--force-reset", "--accept-data-loss"];
|
|
26
|
-
const pm = getPackageManager();
|
|
27
|
-
const pmExec = pm === "pnpm" ? pm : "npx";
|
|
28
|
-
execa.sync(pmExec, ["cedar", ...command], {
|
|
29
|
-
cwd: cedarPaths.api.base,
|
|
30
|
-
stdio: "inherit",
|
|
31
|
-
env: process.env
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
export {
|
|
35
|
-
globalSetup_default as default
|
|
36
|
-
};
|
|
@@ -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,15 +0,0 @@
|
|
|
1
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
3
|
-
try {
|
|
4
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
5
|
-
} catch (e) {
|
|
6
|
-
throw mod = 0, e;
|
|
7
|
-
}
|
|
8
|
-
};
|
|
9
|
-
import * as jestPreset from "./jest-preset.js";
|
|
10
|
-
var require_api = __commonJS({
|
|
11
|
-
"src/config/jest/api/index.ts"(exports, module) {
|
|
12
|
-
module.exports = jestPreset;
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
export default require_api();
|
|
@@ -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,MA0Fb,CAAA;AAED,eAAe,MAAM,CAAA"}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
import { getApiSideDefaultBabelConfig } from "@cedarjs/babel-config";
|
|
3
|
-
import { getPaths } from "@cedarjs/project-config";
|
|
4
|
-
const rwjsPaths = getPaths();
|
|
5
|
-
const { babelrc } = getApiSideDefaultBabelConfig();
|
|
6
|
-
function resolveSubpath(specifier) {
|
|
7
|
-
try {
|
|
8
|
-
return require.resolve(specifier, {
|
|
9
|
-
paths: [rwjsPaths.api.base, rwjsPaths.base]
|
|
10
|
-
});
|
|
11
|
-
} catch {
|
|
12
|
-
return void 0;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
const testingApiPath = resolveSubpath("@cedarjs/testing/api");
|
|
16
|
-
const config = {
|
|
17
|
-
// To make sure other config option which depends on rootDir use
|
|
18
|
-
// correct path, for example, coverageDirectory
|
|
19
|
-
rootDir: rwjsPaths.base,
|
|
20
|
-
roots: [path.join(rwjsPaths.api.src)],
|
|
21
|
-
runner: path.join(__dirname, "../jest-serial-runner.js"),
|
|
22
|
-
testEnvironment: path.join(__dirname, "./RedwoodApiJestEnv.js"),
|
|
23
|
-
globals: {
|
|
24
|
-
__CEDARJS__TEST_IMPORTS: {
|
|
25
|
-
apiSrcPath: rwjsPaths.api.src,
|
|
26
|
-
tearDownCachePath: path.join(
|
|
27
|
-
rwjsPaths.generated.base,
|
|
28
|
-
"scenarioTeardown.json"
|
|
29
|
-
)
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
sandboxInjectedGlobals: ["__CEDARJS__TEST_IMPORTS"],
|
|
33
|
-
displayName: {
|
|
34
|
-
color: "redBright",
|
|
35
|
-
name: "api"
|
|
36
|
-
},
|
|
37
|
-
collectCoverageFrom: [
|
|
38
|
-
"**/*.{js,jsx,ts,tsx,mts,cts}",
|
|
39
|
-
"!**/node_modules/**",
|
|
40
|
-
"!**/dist/**"
|
|
41
|
-
],
|
|
42
|
-
coverageDirectory: path.join(rwjsPaths.base, "coverage"),
|
|
43
|
-
watchPlugins: [
|
|
44
|
-
"jest-watch-typeahead/filename",
|
|
45
|
-
"jest-watch-typeahead/testname"
|
|
46
|
-
],
|
|
47
|
-
// This runs once before all tests
|
|
48
|
-
globalSetup: path.join(__dirname, "./globalSetup.js"),
|
|
49
|
-
// Note this setup runs for each test file!
|
|
50
|
-
setupFilesAfterEnv: [path.join(__dirname, "./jest.setup.js")],
|
|
51
|
-
moduleNameMapper: {
|
|
52
|
-
"^api/(.*)$": path.join(rwjsPaths.base, "api/$1"),
|
|
53
|
-
"^src/(.*)$": path.join(rwjsPaths.api.src, "$1"),
|
|
54
|
-
// @NOTE: Import @cedarjs/testing in api tests, and it automatically remaps to the api side only
|
|
55
|
-
// This is to prevent web stuff leaking into api, and vice versa
|
|
56
|
-
...testingApiPath ? { "^@cedarjs/testing$": testingApiPath } : {},
|
|
57
|
-
// Support for importing files with extensions (like you'd do in ESM projects)
|
|
58
|
-
"^(\\.{1,2}/.*)\\.js$": "$1"
|
|
59
|
-
},
|
|
60
|
-
transform: {
|
|
61
|
-
// `@cedarjs/context`, `@cedarjs/api`, `@cedarjs/graphql-server`, and
|
|
62
|
-
// `@cedarjs/storage` are ESM-only. Two things pull them in at the top
|
|
63
|
-
// level of a generated project's api-side test run: @cedarjs/testing's
|
|
64
|
-
// own api entry point (which virtually every test imports, for
|
|
65
|
-
// scenario/mock helpers — pulls in `@cedarjs/context` and
|
|
66
|
-
// `@cedarjs/graphql-server` via `directive.ts`, and
|
|
67
|
-
// `@cedarjs/api/webhooks` via `apiFunction.ts`), and the *user's own*
|
|
68
|
-
// generated code — the `cedar setup uploads` template imports
|
|
69
|
-
// `@cedarjs/storage`. Jest's CJS runtime can't parse the real ESM these
|
|
70
|
-
// now emit, so they need the same babel-jest carve-out the web preset
|
|
71
|
-
// already uses for ESM-only node_modules packages (see jest-preset.ts
|
|
72
|
-
// on the web side for the fuller explanation of why this is
|
|
73
|
-
// necessary).
|
|
74
|
-
"[/\\\\]node_modules[/\\\\]@cedarjs[/\\\\](context|api|graphql-server|storage)[/\\\\].+\\.js$": [
|
|
75
|
-
"babel-jest",
|
|
76
|
-
{
|
|
77
|
-
babelrc: false,
|
|
78
|
-
configFile: false,
|
|
79
|
-
presets: [
|
|
80
|
-
[require.resolve("@babel/preset-env"), { targets: { node: "20" } }]
|
|
81
|
-
]
|
|
82
|
-
}
|
|
83
|
-
],
|
|
84
|
-
"\\.[cm]?[jt]sx?$": [
|
|
85
|
-
"babel-jest",
|
|
86
|
-
// When jest runs tests in parallel, it serializes the config before passing down options to babel
|
|
87
|
-
// that's why these must be serializable. So ideally, we should just pass reference to a
|
|
88
|
-
// configFile or "extends" a config. But we need a few other option only at root level, so we'll pass
|
|
89
|
-
// here and remove those keys inside "extend"ed config.
|
|
90
|
-
{
|
|
91
|
-
babelrc,
|
|
92
|
-
// babelrc can not reside inside "extend"ed config, that's why we have it here
|
|
93
|
-
configFile: path.resolve(__dirname, "./apiBabelConfig.js")
|
|
94
|
-
}
|
|
95
|
-
]
|
|
96
|
-
},
|
|
97
|
-
// Jest runs api tests as CommonJS, so the ESM-only packages it reaches have
|
|
98
|
-
// to be transformed. `picoquery` is one: `@cedarjs/api/runtime` imports it,
|
|
99
|
-
// and `@cedarjs/graphql-server` pulls that module in, so any test that
|
|
100
|
-
// imports the GraphQL server (directive tests do, through
|
|
101
|
-
// `@cedarjs/testing/api`) loads it.
|
|
102
|
-
transformIgnorePatterns: [
|
|
103
|
-
"[/\\\\]node_modules[/\\\\](?!@cedarjs[/\\\\]context[/\\\\])(?!@cedarjs[/\\\\]api[/\\\\])(?!@cedarjs[/\\\\]graphql-server[/\\\\])(?!@cedarjs[/\\\\]storage[/\\\\])(?!picoquery[/\\\\])"
|
|
104
|
-
],
|
|
105
|
-
testPathIgnorePatterns: [".scenarios.[jt]s$"]
|
|
106
|
-
};
|
|
107
|
-
var jest_preset_default = config;
|
|
108
|
-
export {
|
|
109
|
-
jest_preset_default as default
|
|
110
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jest.setup.d.ts","sourceRoot":"","sources":["../../../../src/config/jest/api/jest.setup.ts"],"names":[],"mappings":""}
|