@cedarjs/testing 7.0.0 → 8.0.0-canary.3265
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/mockContext.d.ts +1 -1
- package/dist/api/mockContext.d.ts.map +1 -1
- 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 -50
- package/dist/cjs/api/checkTestDatabase.d.ts.map +0 -1
- package/dist/cjs/api/checkTestDatabase.js +0 -182
- 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 -86
- 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,43 +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 RedwoodWebJestEnv_exports = {};
|
|
30
|
-
__export(RedwoodWebJestEnv_exports, {
|
|
31
|
-
default: () => RedwoodWebJestEnv_default
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(RedwoodWebJestEnv_exports);
|
|
34
|
-
var import_jest_fixed_jsdom = __toESM(require("jest-fixed-jsdom"), 1);
|
|
35
|
-
class RedwoodWebJestEnvironment extends import_jest_fixed_jsdom.default {
|
|
36
|
-
async setup() {
|
|
37
|
-
await super.setup();
|
|
38
|
-
if (typeof this.global.crypto.subtle === "undefined") {
|
|
39
|
-
this.global.crypto.subtle = {};
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
var RedwoodWebJestEnv_default = RedwoodWebJestEnvironment;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/config/jest/web/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAA;AAM9C,SAAS,UAAU,CAAA"}
|
package/config/jest/web/index.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
for (let key of __getOwnPropNames(from))
|
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
}
|
|
14
|
-
return to;
|
|
15
|
-
};
|
|
16
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
-
mod
|
|
23
|
-
));
|
|
24
|
-
var jestPreset = __toESM(require("./jest-preset.js"), 1);
|
|
25
|
-
module.exports = jestPreset;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var jest_preset_exports = {};
|
|
30
|
-
__export(jest_preset_exports, {
|
|
31
|
-
default: () => jest_preset_default
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(jest_preset_exports);
|
|
34
|
-
var import_node_fs = __toESM(require("node:fs"), 1);
|
|
35
|
-
var import_node_path = __toESM(require("node:path"), 1);
|
|
36
|
-
var import_project_config = require("@cedarjs/project-config");
|
|
37
|
-
const cedarPaths = (0, import_project_config.getPaths)();
|
|
38
|
-
const RESOLVE_FROM = [cedarPaths.web.base, cedarPaths.base];
|
|
39
|
-
function resolvePackageDir(packageName, resolveFrom = RESOLVE_FROM) {
|
|
40
|
-
try {
|
|
41
|
-
return import_node_path.default.dirname(
|
|
42
|
-
require.resolve(`${packageName}/package.json`, { paths: resolveFrom })
|
|
43
|
-
);
|
|
44
|
-
} catch {
|
|
45
|
-
}
|
|
46
|
-
try {
|
|
47
|
-
let dir = import_node_path.default.dirname(require.resolve(packageName, { paths: resolveFrom }));
|
|
48
|
-
for (; ; ) {
|
|
49
|
-
const manifestPath = import_node_path.default.join(dir, "package.json");
|
|
50
|
-
if (import_node_fs.default.existsSync(manifestPath)) {
|
|
51
|
-
const manifest = JSON.parse(
|
|
52
|
-
import_node_fs.default.readFileSync(manifestPath, "utf-8")
|
|
53
|
-
);
|
|
54
|
-
if (manifest && typeof manifest === "object" && "name" in manifest && manifest.name === packageName) {
|
|
55
|
-
return dir;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
const parent = import_node_path.default.dirname(dir);
|
|
59
|
-
if (parent === dir) {
|
|
60
|
-
return void 0;
|
|
61
|
-
}
|
|
62
|
-
dir = parent;
|
|
63
|
-
}
|
|
64
|
-
} catch {
|
|
65
|
-
return void 0;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
function packagePath(packageName, relativePath = "", resolveFrom = RESOLVE_FROM) {
|
|
69
|
-
const packageDir = resolvePackageDir(packageName, resolveFrom);
|
|
70
|
-
return packageDir && import_node_path.default.join(packageDir, relativePath);
|
|
71
|
-
}
|
|
72
|
-
function resolveSubpath(specifier, resolveFrom = RESOLVE_FROM) {
|
|
73
|
-
try {
|
|
74
|
-
return require.resolve(specifier, { paths: resolveFrom });
|
|
75
|
-
} catch {
|
|
76
|
-
return void 0;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
const cedarWebDir = resolvePackageDir("@cedarjs/web");
|
|
80
|
-
const cedarWebResolveFrom = cedarWebDir ? [cedarWebDir, ...RESOLVE_FROM] : RESOLVE_FROM;
|
|
81
|
-
function definedEntries(mappings) {
|
|
82
|
-
return Object.fromEntries(
|
|
83
|
-
Object.entries(mappings).filter(
|
|
84
|
-
(entry) => entry[1] !== void 0
|
|
85
|
-
)
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
const config = {
|
|
89
|
-
// To make sure other config option which depends on rootDir always
|
|
90
|
-
// use correct path, for example, coverageDirectory
|
|
91
|
-
rootDir: cedarPaths.base,
|
|
92
|
-
roots: [import_node_path.default.join(cedarPaths.web.src)],
|
|
93
|
-
// Opting out of jsdom's browser-style export condition resolution (needed to
|
|
94
|
-
// resolve `msw/node`) is handled by the environment itself, via
|
|
95
|
-
// jest-fixed-jsdom
|
|
96
|
-
testEnvironment: import_node_path.default.join(__dirname, "./RedwoodWebJestEnv.js"),
|
|
97
|
-
displayName: {
|
|
98
|
-
color: "blueBright",
|
|
99
|
-
name: "web"
|
|
100
|
-
},
|
|
101
|
-
globals: {
|
|
102
|
-
__RWJS_TESTROOT_DIR: import_node_path.default.join(cedarPaths.web.src),
|
|
103
|
-
// used in jest setup to load mocks
|
|
104
|
-
RWJS_ENV: {
|
|
105
|
-
RWJS_API_URL: "",
|
|
106
|
-
RWJS_API_GRAPHQL_URL: "/",
|
|
107
|
-
__REDWOOD__APP_TITLE: "Redwood App"
|
|
108
|
-
},
|
|
109
|
-
RWJS_DEBUG_ENV: {
|
|
110
|
-
RWJS_SRC_ROOT: cedarPaths.web.src
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
collectCoverageFrom: [
|
|
114
|
-
"**/*.{js,jsx,ts,tsx}",
|
|
115
|
-
"!**/node_modules/**",
|
|
116
|
-
"!**/dist/**"
|
|
117
|
-
],
|
|
118
|
-
coverageDirectory: import_node_path.default.join(cedarPaths.base, "coverage"),
|
|
119
|
-
watchPlugins: [
|
|
120
|
-
"jest-watch-typeahead/filename",
|
|
121
|
-
"jest-watch-typeahead/testname"
|
|
122
|
-
],
|
|
123
|
-
setupFilesAfterEnv: [import_node_path.default.resolve(__dirname, "./jest.setup.js")],
|
|
124
|
-
moduleNameMapper: {
|
|
125
|
-
...definedEntries({
|
|
126
|
-
/**
|
|
127
|
-
* Make sure modules that require different versions of these
|
|
128
|
-
* dependencies end up using the same one.
|
|
129
|
-
*/
|
|
130
|
-
"^react$": resolveSubpath("react"),
|
|
131
|
-
"^react-dom$": resolveSubpath("react-dom"),
|
|
132
|
-
// Point straight at Apollo Client's CJS build. Resolving the subpath
|
|
133
|
-
// would go through its `exports` map and land on the ESM build (Node 22+
|
|
134
|
-
// picks the `module-sync` condition), which Jest can't parse.
|
|
135
|
-
// Resolved starting from `@cedarjs/web` because that's what depends on
|
|
136
|
-
// Apollo — a project doesn't declare it itself, so under pnpm it isn't
|
|
137
|
-
// reachable from the web side at all, and searching from there finds
|
|
138
|
-
// either nothing or some unrelated copy pulled in by another dependency
|
|
139
|
-
"^@apollo/client/react$": packagePath(
|
|
140
|
-
"@apollo/client",
|
|
141
|
-
"__cjs/react/index.cjs",
|
|
142
|
-
cedarWebResolveFrom
|
|
143
|
-
),
|
|
144
|
-
// We replace imports to "@cedarjs/router" with our own "mock" implementation.
|
|
145
|
-
"^@cedarjs/router$": resolveSubpath("@cedarjs/testing/web/MockRouter.js"),
|
|
146
|
-
"^@cedarjs/web$": resolveSubpath("@cedarjs/web"),
|
|
147
|
-
// This allows us to mock `createAuthentication` which is used by auth
|
|
148
|
-
// clients, which in turn lets us mock `useAuth` in tests
|
|
149
|
-
"^@cedarjs/auth$": resolveSubpath("@cedarjs/testing/auth"),
|
|
150
|
-
// @NOTE: Import @cedarjs/testing in web tests, and it automatically remaps to the web side only
|
|
151
|
-
// This is to prevent web stuff leaking into api, and vice versa
|
|
152
|
-
"^@cedarjs/testing$": resolveSubpath("@cedarjs/testing/web"),
|
|
153
|
-
/**
|
|
154
|
-
* Mock out files that aren't particularly useful in tests. See fileMock.js for more info.
|
|
155
|
-
*/
|
|
156
|
-
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|css)$": resolveSubpath("@cedarjs/testing/dist/cjs/web/fileMock.js")
|
|
157
|
-
}),
|
|
158
|
-
"~__CEDAR__USER_ROUTES_FOR_MOCK": cedarPaths.web.routes,
|
|
159
|
-
"~__CEDAR__USER_AUTH_FOR_MOCK": import_node_path.default.join(cedarPaths.web.src, "auth"),
|
|
160
|
-
// Support for importing files with extensions (like you'd do in ESM projects)
|
|
161
|
-
"^(\\.{1,2}/.*)\\.js$": "$1"
|
|
162
|
-
},
|
|
163
|
-
transform: {
|
|
164
|
-
// MSW's CommonJS build `require`s ESM-only packages (`rettime`,
|
|
165
|
-
// `@open-draft/deferred-promise` and `until-async`, which ships ESM in
|
|
166
|
-
// plain `.js` files). Node supports require(esm), but Jest's runtime
|
|
167
|
-
// doesn't, so compile any `.mjs` file that gets pulled in from
|
|
168
|
-
// node_modules (plus until-async) to CommonJS. This needs its own
|
|
169
|
-
// transform entry (with the config inlined) because the web babel config
|
|
170
|
-
// ignores node_modules
|
|
171
|
-
//
|
|
172
|
-
// The `@cedarjs/auth-*-web` packages are ESM-only too, and (like
|
|
173
|
-
// until-async) ship plain `.js` files rather than `.mjs` since their
|
|
174
|
-
// package.json already declares `"type": "module"`. A generated
|
|
175
|
-
// project's `web/src/auth.ts` imports one of these, so they need the
|
|
176
|
-
// same carve-out. `@cedarjs/forms` is ESM-only for the same reason, and
|
|
177
|
-
// gets pulled into virtually every generated project's web-side tests
|
|
178
|
-
// via `web/src/pages/**` scaffolds and dbAuth login/signup forms.
|
|
179
|
-
// `@cedarjs/web`, `@cedarjs/auth`, and `@cedarjs/router` are ESM-only
|
|
180
|
-
// too. `web` and `router` are imported directly by virtually every
|
|
181
|
-
// generated project's web-side test (`Routes.tsx`, page/component
|
|
182
|
-
// scaffolds), and `auth` gets pulled in transitively through `web`.
|
|
183
|
-
// Jest's own module loader re-applies this carve-out to every file it
|
|
184
|
-
// loads, including ones reached transitively through an
|
|
185
|
-
// already-transformed require() call, so all of them need to be listed
|
|
186
|
-
// even though only `web`/`router` are usually imported directly.
|
|
187
|
-
"[/\\\\]node_modules[/\\\\](?:.+\\.mjs|(?:until-async|@cedarjs[/\\\\](?:auth-[a-z-]+-web|forms|web|auth|router))[/\\\\].+\\.js)$": [
|
|
188
|
-
"babel-jest",
|
|
189
|
-
{
|
|
190
|
-
babelrc: false,
|
|
191
|
-
configFile: false,
|
|
192
|
-
presets: [
|
|
193
|
-
[require.resolve("@babel/preset-env"), { targets: { node: "20" } }]
|
|
194
|
-
]
|
|
195
|
-
}
|
|
196
|
-
],
|
|
197
|
-
"\\.[jt]sx?$": [
|
|
198
|
-
"babel-jest",
|
|
199
|
-
// When jest runs tests in parallel, it serializes the config before passing down options to babel
|
|
200
|
-
// that's why these must be serializable. Passing the reference to a config instead.
|
|
201
|
-
{
|
|
202
|
-
configFile: import_node_path.default.resolve(__dirname, "./webBabelConfig.js")
|
|
203
|
-
}
|
|
204
|
-
]
|
|
205
|
-
},
|
|
206
|
-
// Jest's default is to not transform anything in node_modules, but `.mjs`
|
|
207
|
-
// files (and until-async, @cedarjs/auth-*-web, @cedarjs/forms,
|
|
208
|
-
// @cedarjs/web, @cedarjs/auth, and @cedarjs/router) have to be compiled to
|
|
209
|
-
// CommonJS (see the transform above).
|
|
210
|
-
// The `.pnpm` lookahead is what makes this work with pnpm: its virtual store
|
|
211
|
-
// puts packages at `node_modules/.pnpm/<pkg>@<version>/node_modules/<pkg>`,
|
|
212
|
-
// so without it the pattern matches (and thereby ignores) at the *first*
|
|
213
|
-
// `node_modules` segment, where the following path starts with `.pnpm/`
|
|
214
|
-
// instead of `until-async/` and the exception never gets a chance to apply.
|
|
215
|
-
// Skipping that segment forces the match onto the inner `node_modules`,
|
|
216
|
-
// which looks the same as a hoisted npm/yarn layout
|
|
217
|
-
transformIgnorePatterns: [
|
|
218
|
-
"[/\\\\]node_modules[/\\\\](?!\\.pnpm[/\\\\])(?!.*\\.mjs$)(?!until-async[/\\\\])(?!@cedarjs[/\\\\]auth-[a-z-]+-web[/\\\\])(?!@cedarjs[/\\\\]forms[/\\\\])(?!@cedarjs[/\\\\]web[/\\\\])(?!@cedarjs[/\\\\]auth[/\\\\])(?!@cedarjs[/\\\\]router[/\\\\])",
|
|
219
|
-
"\\.pnp\\.[^\\\\/]+$"
|
|
220
|
-
],
|
|
221
|
-
resolver: import_node_path.default.resolve(__dirname, "./resolver.js"),
|
|
222
|
-
testPathIgnorePatterns: [".(stories|mock).[jt]sx?$"]
|
|
223
|
-
};
|
|
224
|
-
var jest_preset_default = config;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import '@testing-library/jest-dom';
|
|
2
|
-
import { mockCurrentUser as _mockCurrentUser } from '../../../web/mockRequests.js';
|
|
3
|
-
declare global {
|
|
4
|
-
var __RWJS_TESTROOT_DIR: string;
|
|
5
|
-
var mockCurrentUser: typeof _mockCurrentUser;
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=jest.setup.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jest.setup.d.ts","sourceRoot":"","sources":["../../../../../src/config/jest/web/jest.setup.ts"],"names":[],"mappings":"AAEA,OAAO,2BAA2B,CAAA;AAGlC,OAAO,EAML,eAAe,IAAI,gBAAgB,EACpC,MAAM,8BAA8B,CAAA;AAErC,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,mBAAmB,EAAE,MAAM,CAAA;IAE/B,IAAI,eAAe,EAAE,OAAO,gBAAgB,CAAA;CAC7C"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var import_jest_dom = require("@testing-library/jest-dom");
|
|
3
|
-
var import_findCellMocks = require("@cedarjs/testing/dist/cjs/web/findCellMocks.js");
|
|
4
|
-
var import_mockRequests = require("@cedarjs/testing/dist/cjs/web/mockRequests.js");
|
|
5
|
-
global.mockGraphQLQuery = import_mockRequests.mockGraphQLQuery;
|
|
6
|
-
global.mockGraphQLMutation = import_mockRequests.mockGraphQLMutation;
|
|
7
|
-
global.mockCurrentUser = import_mockRequests.mockCurrentUser;
|
|
8
|
-
const cellMocks = (0, import_findCellMocks.findCellMocks)(global.__RWJS_TESTROOT_DIR);
|
|
9
|
-
beforeAll(async () => {
|
|
10
|
-
for (const m of cellMocks) {
|
|
11
|
-
require(m);
|
|
12
|
-
}
|
|
13
|
-
await (0, import_mockRequests.startMSW)("node");
|
|
14
|
-
(0, import_mockRequests.setupRequestHandlers)();
|
|
15
|
-
});
|
|
16
|
-
afterEach(() => {
|
|
17
|
-
(0, import_mockRequests.setupRequestHandlers)();
|
|
18
|
-
});
|
|
19
|
-
afterAll(() => {
|
|
20
|
-
(0, import_mockRequests.closeServer)();
|
|
21
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../../../../src/config/jest/web/resolver.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAEnD,iBAAS,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,UAYvD;AAMD,SAAS,QAAQ,CAAA"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
function resolver(path, options) {
|
|
3
|
-
return options.defaultResolver(path, {
|
|
4
|
-
...options,
|
|
5
|
-
packageFilter: (pkg) => {
|
|
6
|
-
if (OVERRIDE_EXPORTS_LIST.has(pkg.name)) {
|
|
7
|
-
delete pkg["exports"];
|
|
8
|
-
delete pkg["module"];
|
|
9
|
-
}
|
|
10
|
-
return pkg;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
const OVERRIDE_EXPORTS_LIST = /* @__PURE__ */ new Set([
|
|
15
|
-
"@firebase/analytics",
|
|
16
|
-
"@firebase/app",
|
|
17
|
-
"@firebase/app-check",
|
|
18
|
-
"@firebase/auth",
|
|
19
|
-
"@firebase/database",
|
|
20
|
-
"@firebase/firestore",
|
|
21
|
-
"@firebase/functions",
|
|
22
|
-
"@firebase/installations",
|
|
23
|
-
"@firebase/messaging",
|
|
24
|
-
"@firebase/performance",
|
|
25
|
-
"@firebase/remote-config",
|
|
26
|
-
"@firebase/storage",
|
|
27
|
-
"@firebase/util",
|
|
28
|
-
"firebase"
|
|
29
|
-
]);
|
|
30
|
-
module.exports = resolver;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
overrides: import("@babel/core").TransformOptions[];
|
|
3
|
-
presets: ((string | undefined)[] | (string | object)[])[];
|
|
4
|
-
plugins: import("@babel/core").TransformOptions[];
|
|
5
|
-
extends: string | undefined;
|
|
6
|
-
babelrc: boolean;
|
|
7
|
-
ignore: string[];
|
|
8
|
-
};
|
|
9
|
-
export default _default;
|
|
10
|
-
//# sourceMappingURL=webBabelConfig.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webBabelConfig.d.ts","sourceRoot":"","sources":["../../../../../src/config/jest/web/webBabelConfig.ts"],"names":[],"mappings":";;;;;;;;AAQA,wBASC"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var webBabelConfig_exports = {};
|
|
30
|
-
__export(webBabelConfig_exports, {
|
|
31
|
-
default: () => webBabelConfig_default
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(webBabelConfig_exports);
|
|
34
|
-
var import_babel_config = require("@cedarjs/babel-config");
|
|
35
|
-
var import_babel_plugin_redwood_cell = __toESM(require("../babelPlugins/babel-plugin-redwood-cell.js"), 1);
|
|
36
|
-
const defaultWebSideBabelConfig = (0, import_babel_config.getWebSideDefaultBabelConfig)({
|
|
37
|
-
forJest: true
|
|
38
|
-
});
|
|
39
|
-
var webBabelConfig_default = {
|
|
40
|
-
...defaultWebSideBabelConfig,
|
|
41
|
-
overrides: [
|
|
42
|
-
...defaultWebSideBabelConfig.overrides,
|
|
43
|
-
{
|
|
44
|
-
test: /.+Cell.(js|tsx|jsx)$/,
|
|
45
|
-
plugins: [import_babel_plugin_redwood_cell.default]
|
|
46
|
-
}
|
|
47
|
-
]
|
|
48
|
-
};
|
package/config/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type":"commonjs"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { APIGatewayProxyEvent, APIGatewayProxyEventHeaders, Context } from 'aws-lambda';
|
|
2
|
-
import type { SupportedVerifierTypes } from '@cedarjs/api/webhooks';
|
|
3
|
-
interface BuildEventParams extends Partial<APIGatewayProxyEvent> {
|
|
4
|
-
payload?: string | null | Record<any, any>;
|
|
5
|
-
signature?: string;
|
|
6
|
-
signatureHeader?: string;
|
|
7
|
-
headers?: APIGatewayProxyEventHeaders;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* @description Use this to mock out the http request event that is received by your function in unit tests
|
|
11
|
-
*
|
|
12
|
-
* @example Mocking sending headers
|
|
13
|
-
* mockHttpEvent({header: {'X-Custom-Header': 'bazinga'}})
|
|
14
|
-
*
|
|
15
|
-
* @example Adding a JSON payload
|
|
16
|
-
* mockHttpEvent({payload: JSON.stringify(mockedRequestBody)})
|
|
17
|
-
*
|
|
18
|
-
* @returns APIGatewayProxyEvent
|
|
19
|
-
*/
|
|
20
|
-
export declare const mockHttpEvent: ({ payload, signature, signatureHeader, queryStringParameters, httpMethod, headers, path, isBase64Encoded, ...others }: BuildEventParams) => APIGatewayProxyEvent;
|
|
21
|
-
/**
|
|
22
|
-
* @description Use this function to mock the http event's context
|
|
23
|
-
* @see: https://docs.aws.amazon.com/lambda/latest/dg/nodejs-context.html
|
|
24
|
-
**/
|
|
25
|
-
export declare const mockContext: () => Context;
|
|
26
|
-
interface MockedSignedWebhookParams extends Omit<BuildEventParams, 'signature' | 'signatureHeader'> {
|
|
27
|
-
signatureType: Exclude<SupportedVerifierTypes, 'skipVerifier'>;
|
|
28
|
-
signatureHeader: string;
|
|
29
|
-
secret: string;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* @description Use this function to mock a signed webhook
|
|
33
|
-
* @see https://cedarjs.com/docs/webhooks#webhooks
|
|
34
|
-
**/
|
|
35
|
-
export declare const mockSignedWebhook: ({ payload, signatureType, signatureHeader, secret, ...others }: MockedSignedWebhookParams) => APIGatewayProxyEvent;
|
|
36
|
-
export {};
|
|
37
|
-
//# sourceMappingURL=apiFunction.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"apiFunction.d.ts","sourceRoot":"","sources":["../../../src/api/apiFunction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,2BAA2B,EAC3B,OAAO,EACR,MAAM,YAAY,CAAA;AAEnB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAGnE,UAAU,gBAAiB,SAAQ,OAAO,CAAC,oBAAoB,CAAC;IAC9D,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,OAAO,CAAC,EAAE,2BAA2B,CAAA;CACtC;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,aAAa,GAAI,uHAU3B,gBAAgB,KAAG,oBAgCrB,CAAA;AAED;;;IAGI;AACJ,eAAO,MAAM,WAAW,QAAO,OAI9B,CAAA;AAED,UAAU,yBAA0B,SAAQ,IAAI,CAC9C,gBAAgB,EAChB,WAAW,GAAG,iBAAiB,CAChC;IACC,aAAa,EAAE,OAAO,CAAC,sBAAsB,EAAE,cAAc,CAAC,CAAA;IAC9D,eAAe,EAAE,MAAM,CAAA;IACvB,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;IAGI;AACJ,eAAO,MAAM,iBAAiB,GAAI,gEAM/B,yBAAyB,yBAe3B,CAAA"}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var apiFunction_exports = {};
|
|
20
|
-
__export(apiFunction_exports, {
|
|
21
|
-
mockContext: () => mockContext,
|
|
22
|
-
mockHttpEvent: () => mockHttpEvent,
|
|
23
|
-
mockSignedWebhook: () => mockSignedWebhook
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(apiFunction_exports);
|
|
26
|
-
var import_webhooks = require("@cedarjs/api/webhooks");
|
|
27
|
-
const mockHttpEvent = ({
|
|
28
|
-
payload = null,
|
|
29
|
-
signature,
|
|
30
|
-
signatureHeader,
|
|
31
|
-
queryStringParameters = null,
|
|
32
|
-
httpMethod = "GET",
|
|
33
|
-
headers = {},
|
|
34
|
-
path = "",
|
|
35
|
-
isBase64Encoded = false,
|
|
36
|
-
...others
|
|
37
|
-
}) => {
|
|
38
|
-
if (signature && signatureHeader) {
|
|
39
|
-
headers[signatureHeader.toLocaleLowerCase()] = signature;
|
|
40
|
-
}
|
|
41
|
-
const payloadAsString = typeof payload === "string" ? payload : JSON.stringify(payload);
|
|
42
|
-
const body = payload === null ? null : isBase64Encoded ? Buffer.from(payloadAsString || "").toString("base64") : payloadAsString;
|
|
43
|
-
return {
|
|
44
|
-
body,
|
|
45
|
-
headers,
|
|
46
|
-
multiValueHeaders: {},
|
|
47
|
-
isBase64Encoded,
|
|
48
|
-
path,
|
|
49
|
-
pathParameters: null,
|
|
50
|
-
stageVariables: null,
|
|
51
|
-
httpMethod,
|
|
52
|
-
queryStringParameters,
|
|
53
|
-
// @ts-expect-error not required for mocks
|
|
54
|
-
requestContext: null,
|
|
55
|
-
// @ts-expect-error not required for mocks
|
|
56
|
-
resource: null,
|
|
57
|
-
multiValueQueryStringParameters: null,
|
|
58
|
-
...others
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
const mockContext = () => {
|
|
62
|
-
const context = {};
|
|
63
|
-
return context;
|
|
64
|
-
};
|
|
65
|
-
const mockSignedWebhook = ({
|
|
66
|
-
payload = null,
|
|
67
|
-
signatureType,
|
|
68
|
-
signatureHeader,
|
|
69
|
-
secret,
|
|
70
|
-
...others
|
|
71
|
-
}) => {
|
|
72
|
-
const payloadAsString = typeof payload === "string" ? payload : JSON.stringify(payload);
|
|
73
|
-
const signature = (0, import_webhooks.signPayload)(signatureType, {
|
|
74
|
-
payload: payloadAsString,
|
|
75
|
-
secret
|
|
76
|
-
});
|
|
77
|
-
return mockHttpEvent({
|
|
78
|
-
payload,
|
|
79
|
-
signature,
|
|
80
|
-
signatureHeader,
|
|
81
|
-
...others
|
|
82
|
-
});
|
|
83
|
-
};
|
|
84
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
85
|
-
0 && (module.exports = {
|
|
86
|
-
mockContext,
|
|
87
|
-
mockHttpEvent,
|
|
88
|
-
mockSignedWebhook
|
|
89
|
-
});
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Redacts credentials from a database connection string so it's safe to
|
|
3
|
-
* print. Handles both URI-style authority credentials, e.g.
|
|
4
|
-
* `postgres://user:pass@host/db` -> `postgres://user:***@host/db`, and
|
|
5
|
-
* semicolon-delimited key/value credentials used by SQL Server connection
|
|
6
|
-
* strings, e.g. `Server=host;Password=secret;` -> `Server=host;Password=***;`.
|
|
7
|
-
*/
|
|
8
|
-
export declare function redactDatabaseUrl(url: string): string;
|
|
9
|
-
/**
|
|
10
|
-
* Checks that the `DATABASE_URL` about to be used for tests matches the
|
|
11
|
-
* datasource provider configured in `schema.prisma`, and throws an
|
|
12
|
-
* actionable error if they don't match.
|
|
13
|
-
*
|
|
14
|
-
* Without this check, running `prisma db push`/`migrate reset` against a
|
|
15
|
-
* mismatched provider/URL combination (e.g. a leftover sqlite fallback URL
|
|
16
|
-
* with a `postgresql` schema) can hang indefinitely with no output, instead
|
|
17
|
-
* of failing fast. See https://github.com/cedarjs/cedar/issues/2284.
|
|
18
|
-
*
|
|
19
|
-
* If the provider can't be determined (e.g. `schema.prisma` doesn't exist
|
|
20
|
-
* yet), this is a no-op — Prisma itself will surface the problem.
|
|
21
|
-
*/
|
|
22
|
-
export declare function checkTestDatabaseUrlMatchesProvider(databaseUrl: string, usedFallback: boolean): Promise<void>;
|
|
23
|
-
/**
|
|
24
|
-
* Guards `cedar test api`'s destructive database reset by *identity*, not
|
|
25
|
-
* just provider: refuses to run when the resolved test database is the same
|
|
26
|
-
* database as `DATABASE_URL` — same host, port, and database name, or the
|
|
27
|
-
* same sqlite file.
|
|
28
|
-
*
|
|
29
|
-
* This is deliberately the only check, rather than also requiring the
|
|
30
|
-
* database's *name* to look test-like (e.g. containing "test" or "e2e"). A
|
|
31
|
-
* naming convention doesn't hold for managed Postgres providers with a
|
|
32
|
-
* fixed default database name shared by every project — every Supabase
|
|
33
|
-
* project's database is named `postgres`, for instance — so it can't tell a
|
|
34
|
-
* real project's database apart from a dedicated test one by name alone.
|
|
35
|
-
* Whether the two connection strings resolve to the same database is the
|
|
36
|
-
* one fact that holds across every provider.
|
|
37
|
-
*
|
|
38
|
-
* When there's no `DATABASE_URL` at all to compare against, this fails
|
|
39
|
-
* closed rather than skipping the check: an explicit `TEST_DATABASE_URL`
|
|
40
|
-
* with nothing to confirm it's not the app's real database is refused,
|
|
41
|
-
* since there'd be no way to tell it apart from one that is. Cedar's own
|
|
42
|
-
* generated sqlite fallback (`usedFallback`) is exempt from that fail-closed
|
|
43
|
-
* refusal — it's a path only Cedar controls, so there's no need to force a
|
|
44
|
-
* `DATABASE_URL` to exist just to permit it — but it still runs through the
|
|
45
|
-
* same-database comparison below whenever a `DATABASE_URL` is present, so a
|
|
46
|
-
* project whose real database happens to live at that same generated path
|
|
47
|
-
* is still caught.
|
|
48
|
-
*/
|
|
49
|
-
export declare function checkTestDatabaseIdentity(testDatabaseUrl: string, mainDatabaseUrl: string | undefined, usedFallback: boolean): void;
|
|
50
|
-
//# sourceMappingURL=checkTestDatabase.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkTestDatabase.d.ts","sourceRoot":"","sources":["../../../src/api/checkTestDatabase.ts"],"names":[],"mappings":"AAoBA;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAIrD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,mCAAmC,CACvD,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,OAAO,iBAmCtB;AAuHD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,yBAAyB,CACvC,eAAe,EAAE,MAAM,EACvB,eAAe,EAAE,MAAM,GAAG,SAAS,EACnC,YAAY,EAAE,OAAO,QAkCtB"}
|