@modern-js/plugin-testing 2.15.0 → 2.17.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +32 -0
- package/dist/cjs/base/config/index.js +15 -39
- package/dist/cjs/base/config/patches/assetsModule.js +7 -35
- package/dist/cjs/base/config/patches/filemock.js +8 -24
- package/dist/cjs/base/config/patches/index.js +13 -28
- package/dist/cjs/base/config/patches/transformer.js +13 -38
- package/dist/cjs/base/config/resolver.js +23 -26
- package/dist/cjs/base/config/testConfigOperator.js +39 -38
- package/dist/cjs/base/config/transformer/babelTransformer.js +16 -37
- package/dist/cjs/base/hook.js +17 -31
- package/dist/cjs/base/index.js +36 -41
- package/dist/cjs/base/runJest.js +31 -57
- package/dist/cjs/base/types/index.js +4 -15
- package/dist/cjs/base/utils.js +30 -53
- package/dist/cjs/cli/bff/app.js +17 -32
- package/dist/cjs/cli/bff/constant.js +7 -25
- package/dist/cjs/cli/bff/index.js +71 -92
- package/dist/cjs/cli/bff/mockAPI.js +115 -92
- package/dist/cjs/cli/bff/setup.js +30 -51
- package/dist/cjs/cli/bff/utils/index.js +21 -45
- package/dist/cjs/cli/index.js +43 -59
- package/dist/cjs/cli/test.js +35 -62
- package/dist/cjs/constant.js +7 -25
- package/dist/cjs/index.js +20 -19
- package/dist/cjs/runtime-testing/app.js +40 -45
- package/dist/cjs/runtime-testing/base.js +34 -40
- package/dist/cjs/runtime-testing/customRender.js +21 -39
- package/dist/cjs/runtime-testing/index.js +19 -18
- package/dist/cjs/runtime-testing/reduck.js +35 -55
- package/dist/cjs/runtime-testing/request.js +16 -39
- package/dist/cjs/runtime-testing/resolvePlugins.js +12 -25
- package/dist/esm/base/config/index.js +146 -139
- package/dist/esm/base/config/patches/assetsModule.js +7 -8
- package/dist/esm/base/config/patches/filemock.js +1 -2
- package/dist/esm/base/config/patches/index.js +214 -207
- package/dist/esm/base/config/patches/transformer.js +27 -28
- package/dist/esm/base/config/resolver.js +22 -35
- package/dist/esm/base/config/testConfigOperator.js +119 -116
- package/dist/esm/base/config/transformer/babelTransformer.js +12 -13
- package/dist/esm/base/hook.js +5 -6
- package/dist/esm/base/index.js +5 -6
- package/dist/esm/base/runJest.js +270 -264
- package/dist/esm/base/types/index.js +1 -1
- package/dist/esm/base/utils.js +66 -67
- package/dist/esm/cli/bff/app.js +187 -179
- package/dist/esm/cli/bff/constant.js +1 -2
- package/dist/esm/cli/bff/index.js +285 -278
- package/dist/esm/cli/bff/mockAPI.js +177 -163
- package/dist/esm/cli/bff/setup.js +182 -174
- package/dist/esm/cli/bff/utils/index.js +40 -41
- package/dist/esm/cli/index.js +249 -242
- package/dist/esm/cli/test.js +172 -166
- package/dist/esm/constant.js +1 -2
- package/dist/esm/runtime-testing/app.js +79 -77
- package/dist/esm/runtime-testing/base.js +2 -3
- package/dist/esm/runtime-testing/customRender.js +30 -31
- package/dist/esm/runtime-testing/reduck.js +72 -73
- package/dist/esm/runtime-testing/request.js +55 -45
- package/dist/esm/runtime-testing/resolvePlugins.js +38 -39
- package/dist/esm-node/base/config/index.js +2 -6
- package/dist/esm-node/base/config/patches/assetsModule.js +1 -4
- package/dist/esm-node/base/config/patches/filemock.js +1 -4
- package/dist/esm-node/base/config/patches/index.js +5 -5
- package/dist/esm-node/base/config/patches/transformer.js +5 -5
- package/dist/esm-node/base/config/resolver.js +20 -19
- package/dist/esm-node/base/config/testConfigOperator.js +30 -13
- package/dist/esm-node/base/config/transformer/babelTransformer.js +3 -6
- package/dist/esm-node/base/hook.js +3 -8
- package/dist/esm-node/base/index.js +5 -13
- package/dist/esm-node/base/runJest.js +8 -20
- package/dist/esm-node/base/types/index.js +1 -0
- package/dist/esm-node/base/utils.js +8 -17
- package/dist/esm-node/cli/bff/app.js +2 -7
- package/dist/esm-node/cli/bff/constant.js +1 -4
- package/dist/esm-node/cli/bff/index.js +43 -54
- package/dist/esm-node/cli/bff/mockAPI.js +65 -59
- package/dist/esm-node/cli/bff/setup.js +11 -19
- package/dist/esm-node/cli/bff/utils/index.js +6 -10
- package/dist/esm-node/cli/index.js +11 -23
- package/dist/esm-node/cli/test.js +19 -28
- package/dist/esm-node/constant.js +1 -4
- package/dist/esm-node/runtime-testing/app.js +22 -10
- package/dist/esm-node/runtime-testing/base.js +2 -6
- package/dist/esm-node/runtime-testing/customRender.js +5 -5
- package/dist/esm-node/runtime-testing/reduck.js +10 -16
- package/dist/esm-node/runtime-testing/request.js +1 -3
- package/dist/esm-node/runtime-testing/resolvePlugins.js +6 -6
- package/package.json +18 -14
package/dist/cjs/cli/test.js
CHANGED
@@ -1,72 +1,45 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
for (var name in all)
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
10
|
-
};
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
13
|
-
for (let key of __getOwnPropNames(from))
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
16
|
-
}
|
17
|
-
return to;
|
18
|
-
};
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
25
|
-
mod
|
26
|
-
));
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
28
|
-
var test_exports = {};
|
29
|
-
__export(test_exports, {
|
30
|
-
default: () => test_default
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "default", {
|
6
|
+
enumerable: true,
|
7
|
+
get: () => _default
|
31
8
|
});
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
9
|
+
const _path = /* @__PURE__ */ _interop_require_default(require("path"));
|
10
|
+
const _babelcompiler = require("@modern-js/babel-compiler");
|
11
|
+
const _base = require("../base");
|
12
|
+
function _interop_require_default(obj) {
|
13
|
+
return obj && obj.__esModule ? obj : {
|
14
|
+
default: obj
|
15
|
+
};
|
16
|
+
}
|
36
17
|
const test = async (api) => {
|
37
|
-
var
|
18
|
+
var _userConfig_tools, _userConfig_tools1;
|
38
19
|
const userConfig = api.useResolvedConfigContext();
|
39
20
|
const appContext = api.useAppContext();
|
40
21
|
userConfig.testing = userConfig.testing || {};
|
41
|
-
const jest = userConfig.testing.jest || (
|
22
|
+
const jest = userConfig.testing.jest || (userConfig === null || userConfig === void 0 ? void 0 : (_userConfig_tools = userConfig.tools) === null || _userConfig_tools === void 0 ? void 0 : _userConfig_tools.jest);
|
42
23
|
if (Array.isArray(jest)) {
|
43
24
|
userConfig.testing.jest = jest[0];
|
44
25
|
}
|
45
|
-
userConfig.testing.jest = userConfig.testing.jest || (
|
46
|
-
const runtimeExportsPath =
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
[
|
60
|
-
require.resolve("@babel/preset-env"),
|
61
|
-
{
|
62
|
-
modules: "cjs"
|
63
|
-
}
|
64
|
-
]
|
26
|
+
userConfig.testing.jest = userConfig.testing.jest || (userConfig === null || userConfig === void 0 ? void 0 : (_userConfig_tools1 = userConfig.tools) === null || _userConfig_tools1 === void 0 ? void 0 : _userConfig_tools1.jest);
|
27
|
+
const runtimeExportsPath = _path.default.join(appContext.internalDirectory, ".runtime-exports");
|
28
|
+
await (0, _babelcompiler.compiler)({
|
29
|
+
sourceDir: runtimeExportsPath,
|
30
|
+
rootDir: runtimeExportsPath,
|
31
|
+
distDir: runtimeExportsPath,
|
32
|
+
quiet: true
|
33
|
+
}, {
|
34
|
+
presets: [
|
35
|
+
[
|
36
|
+
require.resolve("@babel/preset-env"),
|
37
|
+
{
|
38
|
+
modules: "cjs"
|
39
|
+
}
|
65
40
|
]
|
66
|
-
|
67
|
-
);
|
68
|
-
await (0,
|
41
|
+
]
|
42
|
+
});
|
43
|
+
await (0, _base.runTest)(api, userConfig.testing);
|
69
44
|
};
|
70
|
-
|
71
|
-
// Annotate the CommonJS export names for ESM import in node:
|
72
|
-
0 && (module.exports = {});
|
45
|
+
const _default = test;
|
package/dist/cjs/constant.js
CHANGED
@@ -1,27 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
5
|
-
var __export = (target, all) => {
|
6
|
-
for (var name in all)
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
8
|
-
};
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
11
|
-
for (let key of __getOwnPropNames(from))
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
14
|
-
}
|
15
|
-
return to;
|
16
|
-
};
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
18
|
-
var constant_exports = {};
|
19
|
-
__export(constant_exports, {
|
20
|
-
MODERNJS_CONFIG_KEY: () => MODERNJS_CONFIG_KEY
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
21
4
|
});
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
0 && (module.exports = {
|
26
|
-
MODERNJS_CONFIG_KEY
|
5
|
+
Object.defineProperty(exports, "MODERNJS_CONFIG_KEY", {
|
6
|
+
enumerable: true,
|
7
|
+
get: () => MODERNJS_CONFIG_KEY
|
27
8
|
});
|
9
|
+
const MODERNJS_CONFIG_KEY = "__modernjs_config__";
|
package/dist/cjs/index.js
CHANGED
@@ -1,19 +1,20 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
require("@testing-library/jest-dom/extend-expect");
|
6
|
+
require("@testing-library/jest-dom");
|
7
|
+
_export_star(require("./runtime-testing"), exports);
|
8
|
+
function _export_star(from, to) {
|
9
|
+
Object.keys(from).forEach(function(k) {
|
10
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
11
|
+
Object.defineProperty(to, k, {
|
12
|
+
enumerable: true,
|
13
|
+
get: function() {
|
14
|
+
return from[k];
|
15
|
+
}
|
16
|
+
});
|
17
|
+
}
|
18
|
+
});
|
19
|
+
return from;
|
20
|
+
}
|
@@ -1,53 +1,46 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
7
|
-
var __export = (target, all) => {
|
8
|
-
for (var name in all)
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
10
|
-
};
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
13
|
-
for (let key of __getOwnPropNames(from))
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
16
|
-
}
|
17
|
-
return to;
|
18
|
-
};
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
25
|
-
mod
|
26
|
-
));
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
28
|
-
var app_exports = {};
|
29
|
-
__export(app_exports, {
|
30
|
-
default: () => app_default
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
31
4
|
});
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
5
|
+
Object.defineProperty(exports, "default", {
|
6
|
+
enumerable: true,
|
7
|
+
get: () => _default
|
8
|
+
});
|
9
|
+
const _react = /* @__PURE__ */ _interop_require_default(require("react"));
|
10
|
+
const _runtime = require("@modern-js/runtime");
|
11
|
+
const _constant = require("../constant");
|
12
|
+
const _resolvePlugins = /* @__PURE__ */ _interop_require_default(require("./resolvePlugins"));
|
13
|
+
function _define_property(obj, key, value) {
|
14
|
+
if (key in obj) {
|
15
|
+
Object.defineProperty(obj, key, {
|
16
|
+
value,
|
17
|
+
enumerable: true,
|
18
|
+
configurable: true,
|
19
|
+
writable: true
|
20
|
+
});
|
21
|
+
} else {
|
22
|
+
obj[key] = value;
|
39
23
|
}
|
24
|
+
return obj;
|
25
|
+
}
|
26
|
+
function _interop_require_default(obj) {
|
27
|
+
return obj && obj.__esModule ? obj : {
|
28
|
+
default: obj
|
29
|
+
};
|
30
|
+
}
|
31
|
+
class ModernRuntime {
|
40
32
|
init(options) {
|
41
33
|
this.options = options;
|
42
34
|
}
|
43
35
|
createApp(props) {
|
44
|
-
var
|
36
|
+
var _this_options;
|
45
37
|
const { entry, children } = props || {};
|
46
|
-
let runtimeFeatures = (
|
38
|
+
let runtimeFeatures = (_this_options = this.options) === null || _this_options === void 0 ? void 0 : _this_options.runtime;
|
47
39
|
if (entry) {
|
40
|
+
var _this_options_runtimeByEntries;
|
48
41
|
runtimeFeatures = {
|
49
42
|
...runtimeFeatures || {},
|
50
|
-
...(
|
43
|
+
...(_this_options_runtimeByEntries = this.options.runtimeByEntries) === null || _this_options_runtimeByEntries === void 0 ? void 0 : _this_options_runtimeByEntries[entry]
|
51
44
|
};
|
52
45
|
}
|
53
46
|
const Component = () => {
|
@@ -56,11 +49,13 @@ class ModernRuntime {
|
|
56
49
|
}
|
57
50
|
return children;
|
58
51
|
};
|
59
|
-
return (0,
|
60
|
-
plugins: (0,
|
52
|
+
return (0, _runtime.createApp)({
|
53
|
+
plugins: (0, _resolvePlugins.default)(runtimeFeatures || {})
|
61
54
|
})(Component);
|
62
55
|
}
|
56
|
+
constructor(options) {
|
57
|
+
_define_property(this, "options", void 0);
|
58
|
+
this.options = options;
|
59
|
+
}
|
63
60
|
}
|
64
|
-
|
65
|
-
// Annotate the CommonJS export names for ESM import in node:
|
66
|
-
0 && (module.exports = {});
|
61
|
+
const _default = new ModernRuntime(global[_constant.MODERNJS_CONFIG_KEY] || {});
|
@@ -1,42 +1,36 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
7
|
-
var __export = (target, all) => {
|
8
|
-
for (var name in all)
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
10
|
-
};
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
13
|
-
for (let key of __getOwnPropNames(from))
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
16
|
-
}
|
17
|
-
return to;
|
18
|
-
};
|
19
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
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 base_exports = {};
|
30
|
-
__export(base_exports, {
|
31
|
-
renderApp: () => import_customRender.default,
|
32
|
-
testBff: () => import_request.request
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
33
4
|
});
|
34
|
-
|
35
|
-
var
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
5
|
+
function _export(target, all) {
|
6
|
+
for (var name in all)
|
7
|
+
Object.defineProperty(target, name, {
|
8
|
+
enumerable: true,
|
9
|
+
get: all[name]
|
10
|
+
});
|
11
|
+
}
|
12
|
+
_export(exports, {
|
13
|
+
renderApp: () => _customRender.default,
|
14
|
+
testBff: () => _request.request
|
42
15
|
});
|
16
|
+
const _customRender = /* @__PURE__ */ _interop_require_default(require("./customRender"));
|
17
|
+
_export_star(require("@testing-library/react"), exports);
|
18
|
+
const _request = require("./request");
|
19
|
+
function _export_star(from, to) {
|
20
|
+
Object.keys(from).forEach(function(k) {
|
21
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
22
|
+
Object.defineProperty(to, k, {
|
23
|
+
enumerable: true,
|
24
|
+
get: function() {
|
25
|
+
return from[k];
|
26
|
+
}
|
27
|
+
});
|
28
|
+
}
|
29
|
+
});
|
30
|
+
return from;
|
31
|
+
}
|
32
|
+
function _interop_require_default(obj) {
|
33
|
+
return obj && obj.__esModule ? obj : {
|
34
|
+
default: obj
|
35
|
+
};
|
36
|
+
}
|
@@ -1,40 +1,22 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
7
|
-
var __export = (target, all) => {
|
8
|
-
for (var name in all)
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
10
|
-
};
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
13
|
-
for (let key of __getOwnPropNames(from))
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
16
|
-
}
|
17
|
-
return to;
|
18
|
-
};
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
25
|
-
mod
|
26
|
-
));
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
28
|
-
var customRender_exports = {};
|
29
|
-
__export(customRender_exports, {
|
30
|
-
default: () => customRender_default
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
31
4
|
});
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
const
|
37
|
-
const
|
38
|
-
|
39
|
-
|
40
|
-
|
5
|
+
Object.defineProperty(exports, "default", {
|
6
|
+
enumerable: true,
|
7
|
+
get: () => _default
|
8
|
+
});
|
9
|
+
const _react = /* @__PURE__ */ _interop_require_default(require("react"));
|
10
|
+
const _react1 = require("@testing-library/react");
|
11
|
+
const _app = /* @__PURE__ */ _interop_require_default(require("./app"));
|
12
|
+
function _interop_require_default(obj) {
|
13
|
+
return obj && obj.__esModule ? obj : {
|
14
|
+
default: obj
|
15
|
+
};
|
16
|
+
}
|
17
|
+
const WrapModernProviders = (props) => _react.default.createElement(_app.default.createApp(props));
|
18
|
+
const customRender = (ui, options) => (0, _react1.render)(ui, {
|
19
|
+
wrapper: WrapModernProviders,
|
20
|
+
...options
|
21
|
+
});
|
22
|
+
const _default = customRender;
|
@@ -1,18 +1,19 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
_export_star(require("./base"), exports);
|
6
|
+
_export_star(require("./reduck"), exports);
|
7
|
+
function _export_star(from, to) {
|
8
|
+
Object.keys(from).forEach(function(k) {
|
9
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
10
|
+
Object.defineProperty(to, k, {
|
11
|
+
enumerable: true,
|
12
|
+
get: function() {
|
13
|
+
return from[k];
|
14
|
+
}
|
15
|
+
});
|
16
|
+
}
|
17
|
+
});
|
18
|
+
return from;
|
19
|
+
}
|
@@ -1,73 +1,53 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
7
|
-
var __export = (target, all) => {
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
function _export(target, all) {
|
8
6
|
for (var name in all)
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
16
|
-
}
|
17
|
-
return to;
|
18
|
-
};
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
25
|
-
mod
|
26
|
-
));
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
28
|
-
var reduck_exports = {};
|
29
|
-
__export(reduck_exports, {
|
30
|
-
autoActions: () => autoActions,
|
31
|
-
createStore: () => createStore,
|
7
|
+
Object.defineProperty(target, name, {
|
8
|
+
enumerable: true,
|
9
|
+
get: all[name]
|
10
|
+
});
|
11
|
+
}
|
12
|
+
_export(exports, {
|
32
13
|
effects: () => effects,
|
33
|
-
immer: () => immer
|
14
|
+
immer: () => immer,
|
15
|
+
autoActions: () => autoActions,
|
16
|
+
createStore: () => createStore
|
34
17
|
});
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
18
|
+
const _store = require("@modern-js-reduck/store");
|
19
|
+
const _plugineffects = /* @__PURE__ */ _interop_require_default(require("@modern-js-reduck/plugin-effects"));
|
20
|
+
const _pluginautoactions = /* @__PURE__ */ _interop_require_default(require("@modern-js-reduck/plugin-auto-actions"));
|
21
|
+
const _pluginimmutable = /* @__PURE__ */ _interop_require_default(require("@modern-js-reduck/plugin-immutable"));
|
22
|
+
const _constant = require("../constant");
|
23
|
+
function _interop_require_default(obj) {
|
24
|
+
return obj && obj.__esModule ? obj : {
|
25
|
+
default: obj
|
26
|
+
};
|
27
|
+
}
|
28
|
+
const effects = () => _plugineffects.default;
|
29
|
+
const immer = () => _pluginimmutable.default;
|
30
|
+
const autoActions = () => _pluginautoactions.default;
|
44
31
|
const createStore = (props) => {
|
45
32
|
const createStatePlugins = () => {
|
46
|
-
var
|
47
|
-
const modernConfig = global[
|
48
|
-
const stateConfig =
|
33
|
+
var _modernConfig_runtime;
|
34
|
+
const modernConfig = global[_constant.MODERNJS_CONFIG_KEY];
|
35
|
+
const stateConfig = modernConfig === null || modernConfig === void 0 ? void 0 : (_modernConfig_runtime = modernConfig.runtime) === null || _modernConfig_runtime === void 0 ? void 0 : _modernConfig_runtime.state;
|
49
36
|
const plugins = [];
|
50
|
-
if ((stateConfig
|
37
|
+
if ((stateConfig === null || stateConfig === void 0 ? void 0 : stateConfig.effects) !== false) {
|
51
38
|
plugins.push(effects());
|
52
39
|
}
|
53
|
-
if ((stateConfig
|
40
|
+
if ((stateConfig === null || stateConfig === void 0 ? void 0 : stateConfig.autoActions) !== false) {
|
54
41
|
plugins.push(autoActions());
|
55
42
|
}
|
56
|
-
if ((stateConfig
|
43
|
+
if ((stateConfig === null || stateConfig === void 0 ? void 0 : stateConfig.immer) !== false) {
|
57
44
|
plugins.push(immer());
|
58
45
|
}
|
59
|
-
return ((props
|
46
|
+
return ((props === null || props === void 0 ? void 0 : props.plugins) || []).concat(plugins);
|
60
47
|
};
|
61
48
|
const config = {
|
62
49
|
...props || {},
|
63
50
|
plugins: createStatePlugins()
|
64
51
|
};
|
65
|
-
return (0,
|
52
|
+
return (0, _store.createStore)(config);
|
66
53
|
};
|
67
|
-
// Annotate the CommonJS export names for ESM import in node:
|
68
|
-
0 && (module.exports = {
|
69
|
-
autoActions,
|
70
|
-
createStore,
|
71
|
-
effects,
|
72
|
-
immer
|
73
|
-
});
|
@@ -1,49 +1,26 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
for (var name in all)
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
10
|
-
};
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
13
|
-
for (let key of __getOwnPropNames(from))
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
16
|
-
}
|
17
|
-
return to;
|
18
|
-
};
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
25
|
-
mod
|
26
|
-
));
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
28
|
-
var request_exports = {};
|
29
|
-
__export(request_exports, {
|
30
|
-
request: () => request
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "request", {
|
6
|
+
enumerable: true,
|
7
|
+
get: () => request
|
31
8
|
});
|
32
|
-
|
33
|
-
|
34
|
-
|
9
|
+
const _supertest = /* @__PURE__ */ _interop_require_default(require("supertest"));
|
10
|
+
const _app = require("../cli/bff/app");
|
11
|
+
function _interop_require_default(obj) {
|
12
|
+
return obj && obj.__esModule ? obj : {
|
13
|
+
default: obj
|
14
|
+
};
|
15
|
+
}
|
35
16
|
function request(...args) {
|
36
17
|
const [fn, ...extraArgs] = args;
|
37
|
-
const app = (0,
|
18
|
+
const app = (0, _app.getApp)();
|
38
19
|
if (!fn) {
|
39
|
-
return (0,
|
20
|
+
return (0, _supertest.default)(app);
|
40
21
|
}
|
41
22
|
fn.returnHttp = true;
|
42
23
|
const res = fn(...extraArgs);
|
43
24
|
fn.returnHttp = false;
|
44
25
|
return res;
|
45
26
|
}
|
46
|
-
// Annotate the CommonJS export names for ESM import in node:
|
47
|
-
0 && (module.exports = {
|
48
|
-
request
|
49
|
-
});
|