@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
package/dist/cjs/cache/index.js
DELETED
|
@@ -1,104 +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 cache_exports = {};
|
|
20
|
-
__export(cache_exports, {
|
|
21
|
-
partialMatch: () => partialMatch
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(cache_exports);
|
|
24
|
-
expect.extend({
|
|
25
|
-
toHaveCached(cacheClient, keyOrExpectedValue, expectedValue) {
|
|
26
|
-
let value;
|
|
27
|
-
let regexKey;
|
|
28
|
-
let stringKey;
|
|
29
|
-
if (_isKVPair(keyOrExpectedValue, expectedValue)) {
|
|
30
|
-
if (keyOrExpectedValue instanceof RegExp) {
|
|
31
|
-
regexKey = keyOrExpectedValue;
|
|
32
|
-
} else {
|
|
33
|
-
stringKey = keyOrExpectedValue;
|
|
34
|
-
}
|
|
35
|
-
value = expectedValue;
|
|
36
|
-
} else {
|
|
37
|
-
value = keyOrExpectedValue;
|
|
38
|
-
}
|
|
39
|
-
let foundKVPair;
|
|
40
|
-
let found = false;
|
|
41
|
-
if (stringKey) {
|
|
42
|
-
return _checkValueForKey(cacheClient, stringKey, value);
|
|
43
|
-
} else {
|
|
44
|
-
for (const [cachedKey, cachedValue] of Object.entries(
|
|
45
|
-
cacheClient.storage
|
|
46
|
-
)) {
|
|
47
|
-
if (found) {
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
|
-
if (regexKey?.test(cachedKey)) {
|
|
51
|
-
found = true;
|
|
52
|
-
foundKVPair = { key: cachedKey, value: cachedValue.value };
|
|
53
|
-
} else {
|
|
54
|
-
found = cachedValue.value === JSON.stringify(value);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
if (foundKVPair) {
|
|
59
|
-
return _checkValueForKey(cacheClient, foundKVPair.key, value);
|
|
60
|
-
}
|
|
61
|
-
if (found) {
|
|
62
|
-
return {
|
|
63
|
-
pass: true,
|
|
64
|
-
message: () => "Found cached value"
|
|
65
|
-
};
|
|
66
|
-
} else {
|
|
67
|
-
return {
|
|
68
|
-
pass: false,
|
|
69
|
-
message: () => `Expected Cached Value: ${this.utils.printExpected(
|
|
70
|
-
JSON.stringify(value)
|
|
71
|
-
)}
|
|
72
|
-
Cache Contents: ${this.utils.printReceived(cacheClient.storage)}`
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
const _isKVPair = (keyOrCachedValue, cachedValue) => {
|
|
78
|
-
return !!cachedValue && !!keyOrCachedValue;
|
|
79
|
-
};
|
|
80
|
-
const _checkValueForKey = (cacheClient, cacheKey, expectedValue) => {
|
|
81
|
-
try {
|
|
82
|
-
const cachedStringValue = cacheClient.storage[cacheKey]?.value;
|
|
83
|
-
const expectedValueOrMatcher = expectedValue?.$$typeof === /* @__PURE__ */ Symbol.for("jest.asymmetricMatcher") ? expectedValue : JSON.parse(JSON.stringify(expectedValue));
|
|
84
|
-
expect(
|
|
85
|
-
cachedStringValue ? JSON.parse(cachedStringValue) : void 0
|
|
86
|
-
).toEqual(expectedValueOrMatcher);
|
|
87
|
-
return {
|
|
88
|
-
pass: true,
|
|
89
|
-
message: () => `Found cached value with ${cacheKey}`
|
|
90
|
-
};
|
|
91
|
-
} catch (e) {
|
|
92
|
-
return {
|
|
93
|
-
pass: false,
|
|
94
|
-
message: () => e.message
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
const partialMatch = (value) => {
|
|
99
|
-
return Array.isArray(value) ? expect.arrayContaining(value.map((v) => expect.objectContaining(v))) : expect.objectContaining(value);
|
|
100
|
-
};
|
|
101
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
102
|
-
0 && (module.exports = {
|
|
103
|
-
partialMatch
|
|
104
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { EnvironmentContext, JestEnvironmentConfig } from '@jest/environment';
|
|
2
|
-
import { TestEnvironment } from 'jest-environment-node';
|
|
3
|
-
declare class RedwoodApiJestEnvironment extends TestEnvironment {
|
|
4
|
-
private testPath;
|
|
5
|
-
constructor(config: JestEnvironmentConfig, context: EnvironmentContext);
|
|
6
|
-
setup(): Promise<void>;
|
|
7
|
-
teardown(): Promise<void>;
|
|
8
|
-
getVmContext(): import("vm").Context | null;
|
|
9
|
-
}
|
|
10
|
-
export default RedwoodApiJestEnvironment;
|
|
11
|
-
//# sourceMappingURL=RedwoodApiJestEnv.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RedwoodApiJestEnv.d.ts","sourceRoot":"","sources":["../../../../../src/config/jest/api/RedwoodApiJestEnv.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEvD,cAAM,yBAA0B,SAAQ,eAAe;IACrD,OAAO,CAAC,QAAQ,CAAQ;gBAEZ,MAAM,EAAE,qBAAqB,EAAE,OAAO,EAAE,kBAAkB;IAKhE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAMtB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAI/B,YAAY;CAUb;AAED,eAAe,yBAAyB,CAAA"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var RedwoodApiJestEnv_exports = {};
|
|
20
|
-
__export(RedwoodApiJestEnv_exports, {
|
|
21
|
-
default: () => RedwoodApiJestEnv_default
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(RedwoodApiJestEnv_exports);
|
|
24
|
-
var import_jest_environment_node = require("jest-environment-node");
|
|
25
|
-
class RedwoodApiJestEnvironment extends import_jest_environment_node.TestEnvironment {
|
|
26
|
-
testPath;
|
|
27
|
-
constructor(config, context) {
|
|
28
|
-
super(config, context);
|
|
29
|
-
this.testPath = context.testPath;
|
|
30
|
-
}
|
|
31
|
-
async setup() {
|
|
32
|
-
await super.setup();
|
|
33
|
-
this.global.testPath = this.testPath;
|
|
34
|
-
}
|
|
35
|
-
async teardown() {
|
|
36
|
-
await super.teardown();
|
|
37
|
-
}
|
|
38
|
-
getVmContext() {
|
|
39
|
-
return super.getVmContext();
|
|
40
|
-
}
|
|
41
|
-
// async handleTestEvent(event, state) {
|
|
42
|
-
// if (event.name === 'test_start') {
|
|
43
|
-
// // Link to event docs:
|
|
44
|
-
// // https://github.com/facebook/jest/blob/master/packages/jest-types/src/Circus.ts
|
|
45
|
-
// }
|
|
46
|
-
// }
|
|
47
|
-
}
|
|
48
|
-
var RedwoodApiJestEnv_default = RedwoodApiJestEnvironment;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"apiBabelConfig.d.ts","sourceRoot":"","sources":["../../../../../src/config/jest/api/apiBabelConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAG7B,MAAM,uBAAuB,CAAA;AAO9B,KAAK,UAAU,GAAG,IAAI,CACpB,UAAU,CAAC,OAAO,4BAA4B,CAAC,EAC/C,SAAS,CACV,CAAA;AAED,QAAA,MAAM,MAAM,EAAE,UAMb,CAAA;AAED,eAAe,MAAM,CAAA"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var apiBabelConfig_exports = {};
|
|
20
|
-
__export(apiBabelConfig_exports, {
|
|
21
|
-
default: () => apiBabelConfig_default
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(apiBabelConfig_exports);
|
|
24
|
-
var import_babel_config = require("@cedarjs/babel-config");
|
|
25
|
-
const { babelrc: _b, ...defaultBabelConfig } = (0, import_babel_config.getApiSideDefaultBabelConfig)();
|
|
26
|
-
const config = {
|
|
27
|
-
...defaultBabelConfig,
|
|
28
|
-
plugins: (0, import_babel_config.getApiSideBabelPlugins)(),
|
|
29
|
-
presets: (0, import_babel_config.getApiSideBabelPresets)({
|
|
30
|
-
presetEnv: true
|
|
31
|
-
// jest needs code transpiled
|
|
32
|
-
})
|
|
33
|
-
};
|
|
34
|
-
var apiBabelConfig_default = config;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"globalSetup.d.ts","sourceRoot":"","sources":["../../../../../src/config/jest/api/globalSetup.ts"],"names":[],"mappings":"AAEA,OAAO,wBAAwB,CAAA;AAW/B,0CAqCC"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var globalSetup_exports = {};
|
|
30
|
-
__export(globalSetup_exports, {
|
|
31
|
-
default: () => globalSetup_default
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(globalSetup_exports);
|
|
34
|
-
var import_node_path = __toESM(require("node:path"), 1);
|
|
35
|
-
var import_config = require("dotenv-defaults/config");
|
|
36
|
-
var import_execa = __toESM(require("execa"), 1);
|
|
37
|
-
var import_project_config = require("@cedarjs/project-config");
|
|
38
|
-
var import_packageManager = require("@cedarjs/project-config/packageManager");
|
|
39
|
-
var import_checkTestDatabase = require("../../../api/checkTestDatabase.js");
|
|
40
|
-
async function globalSetup_default() {
|
|
41
|
-
if (process.env.SKIP_DB_PUSH === "1") {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
const cedarPaths = (0, import_project_config.getPaths)();
|
|
45
|
-
const defaultDb = `file:${import_node_path.default.join(cedarPaths.generated.base, "test.db")}`;
|
|
46
|
-
const usedFallback = !process.env.TEST_DATABASE_URL;
|
|
47
|
-
process.env.DATABASE_URL = process.env.TEST_DATABASE_URL || defaultDb;
|
|
48
|
-
await (0, import_checkTestDatabase.checkTestDatabaseUrlMatchesProvider)(
|
|
49
|
-
process.env.DATABASE_URL,
|
|
50
|
-
usedFallback
|
|
51
|
-
);
|
|
52
|
-
console.log(
|
|
53
|
-
`Setting up test database: ${(0, import_checkTestDatabase.redactDatabaseUrl)(process.env.DATABASE_URL)}`
|
|
54
|
-
);
|
|
55
|
-
const command = process.env.TEST_DATABASE_STRATEGY === "reset" ? ["prisma", "migrate", "reset", "--force"] : ["prisma", "db", "push", "--force-reset", "--accept-data-loss"];
|
|
56
|
-
const pm = (0, import_packageManager.getPackageManager)();
|
|
57
|
-
const pmExec = pm === "pnpm" ? pm : "npx";
|
|
58
|
-
import_execa.default.sync(pmExec, ["cedar", ...command], {
|
|
59
|
-
cwd: cedarPaths.api.base,
|
|
60
|
-
stdio: "inherit",
|
|
61
|
-
env: process.env
|
|
62
|
-
});
|
|
63
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/config/jest/api/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAA;AAK9C,SAAS,UAAU,CAAA"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
for (let key of __getOwnPropNames(from))
|
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
}
|
|
14
|
-
return to;
|
|
15
|
-
};
|
|
16
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
-
mod
|
|
23
|
-
));
|
|
24
|
-
var jestPreset = __toESM(require("./jest-preset.js"), 1);
|
|
25
|
-
module.exports = jestPreset;
|
|
@@ -1 +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,140 +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_path = __toESM(require("node:path"), 1);
|
|
35
|
-
var import_babel_config = require("@cedarjs/babel-config");
|
|
36
|
-
var import_project_config = require("@cedarjs/project-config");
|
|
37
|
-
const rwjsPaths = (0, import_project_config.getPaths)();
|
|
38
|
-
const { babelrc } = (0, import_babel_config.getApiSideDefaultBabelConfig)();
|
|
39
|
-
function resolveSubpath(specifier) {
|
|
40
|
-
try {
|
|
41
|
-
return require.resolve(specifier, {
|
|
42
|
-
paths: [rwjsPaths.api.base, rwjsPaths.base]
|
|
43
|
-
});
|
|
44
|
-
} catch {
|
|
45
|
-
return void 0;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
const testingApiPath = resolveSubpath("@cedarjs/testing/api");
|
|
49
|
-
const config = {
|
|
50
|
-
// To make sure other config option which depends on rootDir use
|
|
51
|
-
// correct path, for example, coverageDirectory
|
|
52
|
-
rootDir: rwjsPaths.base,
|
|
53
|
-
roots: [import_node_path.default.join(rwjsPaths.api.src)],
|
|
54
|
-
runner: import_node_path.default.join(__dirname, "../jest-serial-runner.js"),
|
|
55
|
-
testEnvironment: import_node_path.default.join(__dirname, "./RedwoodApiJestEnv.js"),
|
|
56
|
-
globals: {
|
|
57
|
-
__CEDARJS__TEST_IMPORTS: {
|
|
58
|
-
apiSrcPath: rwjsPaths.api.src,
|
|
59
|
-
tearDownCachePath: import_node_path.default.join(
|
|
60
|
-
rwjsPaths.generated.base,
|
|
61
|
-
"scenarioTeardown.json"
|
|
62
|
-
)
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
sandboxInjectedGlobals: ["__CEDARJS__TEST_IMPORTS"],
|
|
66
|
-
displayName: {
|
|
67
|
-
color: "redBright",
|
|
68
|
-
name: "api"
|
|
69
|
-
},
|
|
70
|
-
collectCoverageFrom: [
|
|
71
|
-
"**/*.{js,jsx,ts,tsx,mts,cts}",
|
|
72
|
-
"!**/node_modules/**",
|
|
73
|
-
"!**/dist/**"
|
|
74
|
-
],
|
|
75
|
-
coverageDirectory: import_node_path.default.join(rwjsPaths.base, "coverage"),
|
|
76
|
-
watchPlugins: [
|
|
77
|
-
"jest-watch-typeahead/filename",
|
|
78
|
-
"jest-watch-typeahead/testname"
|
|
79
|
-
],
|
|
80
|
-
// This runs once before all tests
|
|
81
|
-
globalSetup: import_node_path.default.join(__dirname, "./globalSetup.js"),
|
|
82
|
-
// Note this setup runs for each test file!
|
|
83
|
-
setupFilesAfterEnv: [import_node_path.default.join(__dirname, "./jest.setup.js")],
|
|
84
|
-
moduleNameMapper: {
|
|
85
|
-
"^api/(.*)$": import_node_path.default.join(rwjsPaths.base, "api/$1"),
|
|
86
|
-
"^src/(.*)$": import_node_path.default.join(rwjsPaths.api.src, "$1"),
|
|
87
|
-
// @NOTE: Import @cedarjs/testing in api tests, and it automatically remaps to the api side only
|
|
88
|
-
// This is to prevent web stuff leaking into api, and vice versa
|
|
89
|
-
...testingApiPath ? { "^@cedarjs/testing$": testingApiPath } : {},
|
|
90
|
-
// Support for importing files with extensions (like you'd do in ESM projects)
|
|
91
|
-
"^(\\.{1,2}/.*)\\.js$": "$1"
|
|
92
|
-
},
|
|
93
|
-
transform: {
|
|
94
|
-
// `@cedarjs/context`, `@cedarjs/api`, `@cedarjs/graphql-server`, and
|
|
95
|
-
// `@cedarjs/storage` are ESM-only. Two things pull them in at the top
|
|
96
|
-
// level of a generated project's api-side test run: @cedarjs/testing's
|
|
97
|
-
// own api entry point (which virtually every test imports, for
|
|
98
|
-
// scenario/mock helpers — pulls in `@cedarjs/context` and
|
|
99
|
-
// `@cedarjs/graphql-server` via `directive.ts`, and
|
|
100
|
-
// `@cedarjs/api/webhooks` via `apiFunction.ts`), and the *user's own*
|
|
101
|
-
// generated code — the `cedar setup uploads` template imports
|
|
102
|
-
// `@cedarjs/storage`. Jest's CJS runtime can't parse the real ESM these
|
|
103
|
-
// now emit, so they need the same babel-jest carve-out the web preset
|
|
104
|
-
// already uses for ESM-only node_modules packages (see jest-preset.ts
|
|
105
|
-
// on the web side for the fuller explanation of why this is
|
|
106
|
-
// necessary).
|
|
107
|
-
"[/\\\\]node_modules[/\\\\]@cedarjs[/\\\\](context|api|graphql-server|storage)[/\\\\].+\\.js$": [
|
|
108
|
-
"babel-jest",
|
|
109
|
-
{
|
|
110
|
-
babelrc: false,
|
|
111
|
-
configFile: false,
|
|
112
|
-
presets: [
|
|
113
|
-
[require.resolve("@babel/preset-env"), { targets: { node: "20" } }]
|
|
114
|
-
]
|
|
115
|
-
}
|
|
116
|
-
],
|
|
117
|
-
"\\.[cm]?[jt]sx?$": [
|
|
118
|
-
"babel-jest",
|
|
119
|
-
// When jest runs tests in parallel, it serializes the config before passing down options to babel
|
|
120
|
-
// that's why these must be serializable. So ideally, we should just pass reference to a
|
|
121
|
-
// configFile or "extends" a config. But we need a few other option only at root level, so we'll pass
|
|
122
|
-
// here and remove those keys inside "extend"ed config.
|
|
123
|
-
{
|
|
124
|
-
babelrc,
|
|
125
|
-
// babelrc can not reside inside "extend"ed config, that's why we have it here
|
|
126
|
-
configFile: import_node_path.default.resolve(__dirname, "./apiBabelConfig.js")
|
|
127
|
-
}
|
|
128
|
-
]
|
|
129
|
-
},
|
|
130
|
-
// Jest runs api tests as CommonJS, so the ESM-only packages it reaches have
|
|
131
|
-
// to be transformed. `picoquery` is one: `@cedarjs/api/runtime` imports it,
|
|
132
|
-
// and `@cedarjs/graphql-server` pulls that module in, so any test that
|
|
133
|
-
// imports the GraphQL server (directive tests do, through
|
|
134
|
-
// `@cedarjs/testing/api`) loads it.
|
|
135
|
-
transformIgnorePatterns: [
|
|
136
|
-
"[/\\\\]node_modules[/\\\\](?!@cedarjs[/\\\\]context[/\\\\])(?!@cedarjs[/\\\\]api[/\\\\])(?!@cedarjs[/\\\\]graphql-server[/\\\\])(?!@cedarjs[/\\\\]storage[/\\\\])(?!picoquery[/\\\\])"
|
|
137
|
-
],
|
|
138
|
-
testPathIgnorePatterns: [".scenarios.[jt]s$"]
|
|
139
|
-
};
|
|
140
|
-
var jest_preset_default = config;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jest.setup.d.ts","sourceRoot":"","sources":["../../../../../src/config/jest/api/jest.setup.ts"],"names":[],"mappings":""}
|