@cedarjs/testing 0.6.1-next.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/jest/api/RedwoodApiJestEnv.d.ts +11 -0
- package/config/jest/api/RedwoodApiJestEnv.d.ts.map +1 -0
- package/config/jest/api/RedwoodApiJestEnv.js +33 -16
- package/config/jest/api/apiBabelConfig.d.ts +5 -0
- package/config/jest/api/apiBabelConfig.d.ts.map +1 -0
- package/config/jest/api/apiBabelConfig.js +33 -17
- package/config/jest/api/globalSetup.d.ts +3 -0
- package/config/jest/api/globalSetup.d.ts.map +1 -0
- package/config/jest/api/globalSetup.js +59 -44
- package/config/jest/api/index.d.ts +3 -0
- package/config/jest/api/index.d.ts.map +1 -0
- package/config/jest/api/index.js +25 -2
- package/config/jest/api/jest-preset.d.ts +4 -0
- package/config/jest/api/jest-preset.d.ts.map +1 -0
- package/config/jest/api/jest-preset.js +69 -39
- package/config/jest/api/jest.setup.d.ts +2 -0
- package/config/jest/api/jest.setup.d.ts.map +1 -0
- package/config/jest/api/jest.setup.js +189 -248
- package/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts +11 -0
- package/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts.map +1 -0
- package/config/jest/babelPlugins/babel-plugin-redwood-cell.js +103 -124
- package/config/jest/jest-serial-runner.d.ts +8 -0
- package/config/jest/jest-serial-runner.d.ts.map +1 -0
- package/config/jest/jest-serial-runner.js +33 -9
- package/config/jest/web/RedwoodWebJestEnv.d.ts +6 -0
- package/config/jest/web/RedwoodWebJestEnv.d.ts.map +1 -0
- package/config/jest/web/RedwoodWebJestEnv.js +33 -12
- package/config/jest/web/index.d.ts +3 -0
- package/config/jest/web/index.d.ts.map +1 -0
- package/config/jest/web/index.js +25 -2
- package/config/jest/web/jest-preset.d.ts +4 -0
- package/config/jest/web/jest-preset.d.ts.map +1 -0
- package/config/jest/web/jest-preset.js +78 -50
- package/config/jest/web/jest.setup.d.ts +8 -0
- package/config/jest/web/jest.setup.d.ts.map +1 -0
- package/config/jest/web/jest.setup.js +17 -36
- package/config/jest/web/resolver.d.ts +4 -0
- package/config/jest/web/resolver.d.ts.map +1 -0
- package/config/jest/web/resolver.js +24 -31
- package/config/jest/web/webBabelConfig.d.ts +10 -0
- package/config/jest/web/webBabelConfig.d.ts.map +1 -0
- package/config/jest/web/webBabelConfig.js +43 -13
- package/config/package.json +1 -0
- package/dist/api/directUrlHelpers.d.ts.map +1 -1
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +1 -0
- package/dist/cjs/api/directUrlHelpers.d.ts.map +1 -1
- package/dist/cjs/api/index.d.ts +1 -0
- package/dist/cjs/api/index.d.ts.map +1 -1
- package/dist/cjs/api/index.js +3 -1
- package/dist/cjs/config/jest/api/RedwoodApiJestEnv.d.ts +11 -0
- package/dist/cjs/config/jest/api/RedwoodApiJestEnv.d.ts.map +1 -0
- package/dist/cjs/config/jest/api/RedwoodApiJestEnv.js +48 -0
- package/dist/cjs/config/jest/api/apiBabelConfig.d.ts +5 -0
- package/dist/cjs/config/jest/api/apiBabelConfig.d.ts.map +1 -0
- package/dist/cjs/config/jest/api/apiBabelConfig.js +34 -0
- package/dist/cjs/config/jest/api/globalSetup.d.ts +3 -0
- package/dist/cjs/config/jest/api/globalSetup.d.ts.map +1 -0
- package/dist/cjs/config/jest/api/globalSetup.js +61 -0
- package/dist/cjs/config/jest/api/index.d.ts +3 -0
- package/dist/cjs/config/jest/api/index.d.ts.map +1 -0
- package/dist/cjs/config/jest/api/index.js +25 -0
- package/dist/cjs/config/jest/api/jest-preset.d.ts +4 -0
- package/dist/cjs/config/jest/api/jest-preset.d.ts.map +1 -0
- package/dist/cjs/config/jest/api/jest-preset.js +97 -0
- package/dist/cjs/config/jest/api/jest.setup.d.ts +2 -0
- package/dist/cjs/config/jest/api/jest.setup.d.ts.map +1 -0
- package/dist/cjs/config/jest/api/jest.setup.js +267 -0
- package/dist/cjs/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts +11 -0
- package/dist/cjs/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts.map +1 -0
- package/dist/cjs/config/jest/babelPlugins/babel-plugin-redwood-cell.js +121 -0
- package/dist/cjs/config/jest/jest-serial-runner.d.ts +8 -0
- package/dist/cjs/config/jest/jest-serial-runner.d.ts.map +1 -0
- package/dist/cjs/config/jest/jest-serial-runner.js +37 -0
- package/dist/cjs/config/jest/web/RedwoodWebJestEnv.d.ts +6 -0
- package/dist/cjs/config/jest/web/RedwoodWebJestEnv.d.ts.map +1 -0
- package/dist/cjs/config/jest/web/RedwoodWebJestEnv.js +38 -0
- package/dist/cjs/config/jest/web/index.d.ts +3 -0
- package/dist/cjs/config/jest/web/index.d.ts.map +1 -0
- package/dist/cjs/config/jest/web/index.js +25 -0
- package/dist/cjs/config/jest/web/jest-preset.d.ts +4 -0
- package/dist/cjs/config/jest/web/jest-preset.d.ts.map +1 -0
- package/dist/cjs/config/jest/web/jest-preset.js +117 -0
- package/dist/cjs/config/jest/web/jest.setup.d.ts +8 -0
- package/dist/cjs/config/jest/web/jest.setup.d.ts.map +1 -0
- package/dist/cjs/config/jest/web/jest.setup.js +22 -0
- package/dist/cjs/config/jest/web/resolver.d.ts +4 -0
- package/dist/cjs/config/jest/web/resolver.d.ts.map +1 -0
- package/dist/cjs/config/jest/web/resolver.js +30 -0
- package/dist/cjs/config/jest/web/webBabelConfig.d.ts +10 -0
- package/dist/cjs/config/jest/web/webBabelConfig.d.ts.map +1 -0
- package/dist/cjs/config/jest/web/webBabelConfig.js +48 -0
- package/dist/cjs/web/global.d.ts +2 -2
- package/dist/cjs/web/global.d.ts.map +1 -1
- package/dist/config/jest/api/RedwoodApiJestEnv.d.ts +11 -0
- package/dist/config/jest/api/RedwoodApiJestEnv.d.ts.map +1 -0
- package/dist/config/jest/api/RedwoodApiJestEnv.js +28 -0
- package/dist/config/jest/api/apiBabelConfig.d.ts +5 -0
- package/dist/config/jest/api/apiBabelConfig.d.ts.map +1 -0
- package/dist/config/jest/api/apiBabelConfig.js +18 -0
- package/dist/config/jest/api/globalSetup.d.ts +3 -0
- package/dist/config/jest/api/globalSetup.d.ts.map +1 -0
- package/dist/config/jest/api/globalSetup.js +34 -0
- package/dist/config/jest/api/index.d.ts +3 -0
- package/dist/config/jest/api/index.d.ts.map +1 -0
- package/dist/config/jest/api/index.js +11 -0
- package/dist/config/jest/api/jest-preset.d.ts +4 -0
- package/dist/config/jest/api/jest-preset.d.ts.map +1 -0
- package/dist/config/jest/api/jest-preset.js +67 -0
- package/dist/config/jest/api/jest.setup.d.ts +2 -0
- package/dist/config/jest/api/jest.setup.d.ts.map +1 -0
- package/dist/config/jest/api/jest.setup.js +244 -0
- package/dist/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts +11 -0
- package/dist/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts.map +1 -0
- package/dist/config/jest/babelPlugins/babel-plugin-redwood-cell.js +101 -0
- package/dist/config/jest/jest-serial-runner.d.ts +8 -0
- package/dist/config/jest/jest-serial-runner.d.ts.map +1 -0
- package/dist/config/jest/jest-serial-runner.js +23 -0
- package/dist/config/jest/web/RedwoodWebJestEnv.d.ts +6 -0
- package/dist/config/jest/web/RedwoodWebJestEnv.d.ts.map +1 -0
- package/dist/config/jest/web/RedwoodWebJestEnv.js +18 -0
- package/dist/config/jest/web/index.d.ts +3 -0
- package/dist/config/jest/web/index.d.ts.map +1 -0
- package/dist/config/jest/web/index.js +11 -0
- package/dist/config/jest/web/jest-preset.d.ts +4 -0
- package/dist/config/jest/web/jest-preset.d.ts.map +1 -0
- package/dist/config/jest/web/jest-preset.js +87 -0
- package/dist/config/jest/web/jest.setup.d.ts +8 -0
- package/dist/config/jest/web/jest.setup.d.ts.map +1 -0
- package/dist/config/jest/web/jest.setup.js +28 -0
- package/dist/config/jest/web/resolver.d.ts +4 -0
- package/dist/config/jest/web/resolver.d.ts.map +1 -0
- package/dist/config/jest/web/resolver.js +38 -0
- package/dist/config/jest/web/webBabelConfig.d.ts +10 -0
- package/dist/config/jest/web/webBabelConfig.d.ts.map +1 -0
- package/dist/config/jest/web/webBabelConfig.js +18 -0
- package/dist/web/global.d.ts +2 -2
- package/dist/web/global.d.ts.map +1 -1
- package/package.json +20 -11
- package/config/jest/babelPlugins/__tests__/__fixtures__/cell/cell-with-commented-exports/code.js +0 -28
- package/config/jest/babelPlugins/__tests__/__fixtures__/cell/cell-with-commented-exports/output.js +0 -35
- package/config/jest/babelPlugins/__tests__/__fixtures__/cell/cell-with-default-and-other-named-export/code.js +0 -7
- package/config/jest/babelPlugins/__tests__/__fixtures__/cell/cell-with-default-and-other-named-export/output.js +0 -6
- package/config/jest/babelPlugins/__tests__/__fixtures__/cell/cell-with-default-export/code.js +0 -3
- package/config/jest/babelPlugins/__tests__/__fixtures__/cell/cell-with-default-export/output.js +0 -3
- package/config/jest/babelPlugins/__tests__/__fixtures__/cell/cell-with-required-exports/code.js +0 -28
- package/config/jest/babelPlugins/__tests__/__fixtures__/cell/cell-with-required-exports/output.js +0 -34
- package/config/jest/babelPlugins/__tests__/__fixtures__/viteDistDir/client-build-manifest.json +0 -59
- package/config/jest/babelPlugins/__tests__/babel-plugin-redwood-cell.test.ts +0 -11
- package/config/jest/package.json +0 -3
|
@@ -1,41 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
require(
|
|
4
|
-
require(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
closeServer,
|
|
11
|
-
mockGraphQLMutation,
|
|
12
|
-
mockGraphQLQuery,
|
|
13
|
-
mockCurrentUser,
|
|
14
|
-
} = require('@cedarjs/testing/dist/cjs/web/mockRequests')
|
|
15
|
-
|
|
16
|
-
global.mockGraphQLQuery = mockGraphQLQuery
|
|
17
|
-
global.mockGraphQLMutation = mockGraphQLMutation
|
|
18
|
-
global.mockCurrentUser = mockCurrentUser
|
|
19
|
-
|
|
20
|
-
// NOTE: for performance reasons, we're not using rwjs/internal here
|
|
21
|
-
// This way we can make sure only the imports we require are loaded
|
|
22
|
-
const cellMocks = findCellMocks(global.__RWJS_TESTROOT_DIR)
|
|
23
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var import_jest_dom = require("@testing-library/jest-dom");
|
|
3
|
+
var import_whatwg_fetch = require("whatwg-fetch");
|
|
4
|
+
var import_findCellMocks = require("@cedarjs/testing/dist/cjs/web/findCellMocks.js");
|
|
5
|
+
var import_mockRequests = require("@cedarjs/testing/dist/cjs/web/mockRequests.js");
|
|
6
|
+
global.mockGraphQLQuery = import_mockRequests.mockGraphQLQuery;
|
|
7
|
+
global.mockGraphQLMutation = import_mockRequests.mockGraphQLMutation;
|
|
8
|
+
global.mockCurrentUser = import_mockRequests.mockCurrentUser;
|
|
9
|
+
const cellMocks = (0, import_findCellMocks.findCellMocks)(global.__RWJS_TESTROOT_DIR);
|
|
24
10
|
beforeAll(async () => {
|
|
25
11
|
for (const m of cellMocks) {
|
|
26
|
-
|
|
27
|
-
// see packages/internal/src/build/babelPlugins/babel-plugin-redwood-mock-cell-data.ts
|
|
28
|
-
require(m)
|
|
12
|
+
require(m);
|
|
29
13
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
})
|
|
34
|
-
|
|
14
|
+
await (0, import_mockRequests.startMSW)("node");
|
|
15
|
+
(0, import_mockRequests.setupRequestHandlers)();
|
|
16
|
+
});
|
|
35
17
|
afterEach(() => {
|
|
36
|
-
setupRequestHandlers()
|
|
37
|
-
})
|
|
38
|
-
|
|
18
|
+
(0, import_mockRequests.setupRequestHandlers)();
|
|
19
|
+
});
|
|
39
20
|
afterAll(() => {
|
|
40
|
-
closeServer()
|
|
41
|
-
})
|
|
21
|
+
(0, import_mockRequests.closeServer)();
|
|
22
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
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,37 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
// - https://github.com/microsoft/accessibility-insights-web/pull/5421#issuecomment-1109168149.
|
|
4
|
-
//
|
|
5
|
-
// TL;DR, we need to resolve uuid to a CommonJS version. So we leverage jest's default resolver,
|
|
6
|
-
// but use `packageFilter` to process parsed `package.json` before resolution. In doing so,
|
|
7
|
-
// we only override how jest resolves uuid.
|
|
8
|
-
module.exports = (path, options) => {
|
|
1
|
+
"use strict";
|
|
2
|
+
function resolver(path, options) {
|
|
9
3
|
return options.defaultResolver(path, {
|
|
10
4
|
...options,
|
|
11
5
|
packageFilter: (pkg) => {
|
|
12
6
|
if (OVERRIDE_EXPORTS_LIST.has(pkg.name)) {
|
|
13
|
-
delete pkg[
|
|
14
|
-
delete pkg[
|
|
7
|
+
delete pkg["exports"];
|
|
8
|
+
delete pkg["module"];
|
|
15
9
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
})
|
|
10
|
+
return pkg;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
20
13
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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;
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webBabelConfig.d.ts","sourceRoot":"","sources":["../../../../../src/config/jest/web/webBabelConfig.ts"],"names":[],"mappings":";;;;;;;;AAQA,wBASC"}
|
|
@@ -1,18 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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 = {
|
|
10
40
|
...defaultWebSideBabelConfig,
|
|
11
41
|
overrides: [
|
|
12
42
|
...defaultWebSideBabelConfig.overrides,
|
|
13
43
|
{
|
|
14
44
|
test: /.+Cell.(js|tsx|jsx)$/,
|
|
15
|
-
plugins: [
|
|
16
|
-
}
|
|
17
|
-
]
|
|
18
|
-
}
|
|
45
|
+
plugins: [import_babel_plugin_redwood_cell.default]
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directUrlHelpers.d.ts","sourceRoot":"","sources":["../../src/api/directUrlHelpers.ts"],"names":[],"mappings":"AAEA,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,UAE3C;AAED,wBAAgB,wBAAwB,CACtC,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"directUrlHelpers.d.ts","sourceRoot":"","sources":["../../src/api/directUrlHelpers.ts"],"names":[],"mappings":"AAEA,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,UAE3C;AAED,wBAAgB,wBAAwB,CACtC,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,sBA+BlB"}
|
package/dist/api/index.d.ts
CHANGED
package/dist/api/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,uBAAuB,CAAA"}
|
package/dist/api/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directUrlHelpers.d.ts","sourceRoot":"","sources":["../../../src/api/directUrlHelpers.ts"],"names":[],"mappings":"AAEA,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,UAE3C;AAED,wBAAgB,wBAAwB,CACtC,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"directUrlHelpers.d.ts","sourceRoot":"","sources":["../../../src/api/directUrlHelpers.ts"],"names":[],"mappings":"AAEA,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,UAE3C;AAED,wBAAgB,wBAAwB,CACtC,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,sBA+BlB"}
|
package/dist/cjs/api/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,uBAAuB,CAAA"}
|
package/dist/cjs/api/index.js
CHANGED
|
@@ -18,9 +18,11 @@ module.exports = __toCommonJS(api_exports);
|
|
|
18
18
|
__reExport(api_exports, require("./apiFunction.js"), module.exports);
|
|
19
19
|
__reExport(api_exports, require("./scenario.js"), module.exports);
|
|
20
20
|
__reExport(api_exports, require("./directive.js"), module.exports);
|
|
21
|
+
__reExport(api_exports, require("./directUrlHelpers.js"), module.exports);
|
|
21
22
|
// Annotate the CommonJS export names for ESM import in node:
|
|
22
23
|
0 && (module.exports = {
|
|
23
24
|
...require("./apiFunction.js"),
|
|
24
25
|
...require("./scenario.js"),
|
|
25
|
-
...require("./directive.js")
|
|
26
|
+
...require("./directive.js"),
|
|
27
|
+
...require("./directUrlHelpers.js")
|
|
26
28
|
});
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,48 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiBabelConfig.d.ts","sourceRoot":"","sources":["../../../../../src/config/jest/api/apiBabelConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAG7B,MAAM,uBAAuB,CAAA;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"}
|
|
@@ -0,0 +1,34 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"globalSetup.d.ts","sourceRoot":"","sources":["../../../../../src/config/jest/api/globalSetup.ts"],"names":[],"mappings":"AACA,OAAO,wBAAwB,CAAA;AAY/B,0CAoCC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
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_internals = require("@prisma/internals");
|
|
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_directUrlHelpers = require("../../../api/directUrlHelpers.js");
|
|
39
|
+
const rwjsPaths = (0, import_project_config.getPaths)();
|
|
40
|
+
async function globalSetup_default() {
|
|
41
|
+
if (process.env.SKIP_DB_PUSH === "1") {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const defaultDb = (0, import_directUrlHelpers.getDefaultDb)(rwjsPaths.base);
|
|
45
|
+
process.env.DATABASE_URL = process.env.TEST_DATABASE_URL || defaultDb;
|
|
46
|
+
const prismaSchema = (await (0, import_internals.getSchema)(rwjsPaths.api.dbSchema)).toString();
|
|
47
|
+
const directUrlEnvVar = (0, import_directUrlHelpers.checkAndReplaceDirectUrl)(prismaSchema, defaultDb);
|
|
48
|
+
const command = process.env.TEST_DATABASE_STRATEGY === "reset" ? ["prisma", "migrate", "reset", "--force", "--skip-seed"] : ["prisma", "db", "push", "--force-reset", "--accept-data-loss"];
|
|
49
|
+
const env = {
|
|
50
|
+
DATABASE_URL: process.env.DATABASE_URL
|
|
51
|
+
};
|
|
52
|
+
if (directUrlEnvVar) {
|
|
53
|
+
env[directUrlEnvVar] = process.env[directUrlEnvVar];
|
|
54
|
+
}
|
|
55
|
+
import_execa.default.sync("yarn rw", command, {
|
|
56
|
+
cwd: rwjsPaths.api.base,
|
|
57
|
+
stdio: "inherit",
|
|
58
|
+
shell: true,
|
|
59
|
+
env
|
|
60
|
+
});
|
|
61
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,25 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jest-preset.d.ts","sourceRoot":"","sources":["../../../../../src/config/jest/api/jest-preset.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AASlC,QAAA,MAAM,MAAM,EAAE,MAuDb,CAAA;AAED,eAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,97 @@
|
|
|
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 NODE_MODULES_PATH = import_node_path.default.join(rwjsPaths.base, "node_modules");
|
|
39
|
+
const { babelrc } = (0, import_babel_config.getApiSideDefaultBabelConfig)();
|
|
40
|
+
const config = {
|
|
41
|
+
// To make sure other config option which depends on rootDir use
|
|
42
|
+
// correct path, for example, coverageDirectory
|
|
43
|
+
rootDir: rwjsPaths.base,
|
|
44
|
+
roots: [import_node_path.default.join(rwjsPaths.api.src)],
|
|
45
|
+
runner: import_node_path.default.join(__dirname, "../jest-serial-runner.js"),
|
|
46
|
+
testEnvironment: import_node_path.default.join(__dirname, "./RedwoodApiJestEnv.js"),
|
|
47
|
+
globals: {
|
|
48
|
+
__RWJS__TEST_IMPORTS: {
|
|
49
|
+
apiSrcPath: rwjsPaths.api.src,
|
|
50
|
+
tearDownCachePath: import_node_path.default.join(
|
|
51
|
+
rwjsPaths.generated.base,
|
|
52
|
+
"scenarioTeardown.json"
|
|
53
|
+
),
|
|
54
|
+
dbSchemaPath: rwjsPaths.api.dbSchema
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
sandboxInjectedGlobals: ["__RWJS__TEST_IMPORTS"],
|
|
58
|
+
displayName: {
|
|
59
|
+
color: "redBright",
|
|
60
|
+
name: "api"
|
|
61
|
+
},
|
|
62
|
+
collectCoverageFrom: [
|
|
63
|
+
"**/*.{js,jsx,ts,tsx}",
|
|
64
|
+
"!**/node_modules/**",
|
|
65
|
+
"!**/dist/**"
|
|
66
|
+
],
|
|
67
|
+
coverageDirectory: import_node_path.default.join(rwjsPaths.base, "coverage"),
|
|
68
|
+
watchPlugins: [
|
|
69
|
+
"jest-watch-typeahead/filename",
|
|
70
|
+
"jest-watch-typeahead/testname"
|
|
71
|
+
],
|
|
72
|
+
// This runs once before all tests
|
|
73
|
+
globalSetup: import_node_path.default.join(__dirname, "./globalSetup.js"),
|
|
74
|
+
// Note this setup runs for each test file!
|
|
75
|
+
setupFilesAfterEnv: [import_node_path.default.join(__dirname, "./jest.setup.js")],
|
|
76
|
+
moduleNameMapper: {
|
|
77
|
+
// @NOTE: Import @cedarjs/testing in api tests, and it automatically remaps to the api side only
|
|
78
|
+
// This is to prevent web stuff leaking into api, and vice versa
|
|
79
|
+
"^@cedarjs/testing$": import_node_path.default.join(NODE_MODULES_PATH, "@cedarjs/testing/api")
|
|
80
|
+
},
|
|
81
|
+
transform: {
|
|
82
|
+
"\\.[jt]sx?$": [
|
|
83
|
+
"babel-jest",
|
|
84
|
+
// When jest runs tests in parallel, it serializes the config before passing down options to babel
|
|
85
|
+
// that's why these must be serializable. So ideally, we should just pass reference to a
|
|
86
|
+
// configFile or "extends" a config. But we need a few other option only at root level, so we'll pass
|
|
87
|
+
// here and remove those keys inside "extend"ed config.
|
|
88
|
+
{
|
|
89
|
+
babelrc,
|
|
90
|
+
// babelrc can not reside inside "extend"ed config, that's why we have it here
|
|
91
|
+
configFile: import_node_path.default.resolve(__dirname, "./apiBabelConfig.js")
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
testPathIgnorePatterns: [".scenarios.[jt]s$"]
|
|
96
|
+
};
|
|
97
|
+
var jest_preset_default = config;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jest.setup.d.ts","sourceRoot":"","sources":["../../../../../src/config/jest/api/jest.setup.ts"],"names":[],"mappings":""}
|