@modern-js/plugin-testing 0.0.0-next-20230206032306 → 0.0.0-next-20230206053555
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/CHANGELOG.md +10 -10
- package/README.md +1 -2
- package/dist/js/treeshaking/base/config/transformer/babelTransformer.js +2 -2
- package/dist/js/treeshaking/base/runJest.js +2 -2
- package/dist/js/treeshaking/cli/bff/index.js +2 -2
- package/dist/js/treeshaking/cli/bff/mockAPI.js +1 -1
- package/dist/js/treeshaking/cli/bff/setup.js +2 -2
- package/dist/js/treeshaking/cli/test.js +3 -3
- package/dist/js/treeshaking/runtime-testing/app.js +5 -5
- package/dist/js/treeshaking/runtime-testing/reduck.js +2 -2
- package/package.json +14 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
# @modern-js/plugin-testing
|
|
2
2
|
|
|
3
|
-
## 0.0.0-next-
|
|
3
|
+
## 0.0.0-next-20230206053555
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
- Updated dependencies [
|
|
8
|
-
- Updated dependencies [
|
|
9
|
-
- Updated dependencies [
|
|
10
|
-
- @modern-js/utils@0.0.0-next-
|
|
11
|
-
- @modern-js/runtime@0.0.0-next-
|
|
12
|
-
- @modern-js/babel-preset-app@0.0.0-next-
|
|
13
|
-
- @modern-js/prod-server@0.0.0-next-
|
|
14
|
-
- @modern-js/babel-compiler@0.0.0-next-
|
|
15
|
-
- @modern-js/plugin@0.0.0-next-
|
|
7
|
+
- Updated dependencies [98a2733ac]
|
|
8
|
+
- Updated dependencies [9e907ec3d]
|
|
9
|
+
- Updated dependencies [8c2db5f82]
|
|
10
|
+
- @modern-js/utils@0.0.0-next-20230206053555
|
|
11
|
+
- @modern-js/runtime@0.0.0-next-20230206053555
|
|
12
|
+
- @modern-js/babel-preset-app@0.0.0-next-20230206053555
|
|
13
|
+
- @modern-js/prod-server@0.0.0-next-20230206053555
|
|
14
|
+
- @modern-js/babel-compiler@0.0.0-next-20230206053555
|
|
15
|
+
- @modern-js/plugin@0.0.0-next-20230206053555
|
|
16
16
|
|
|
17
17
|
## 2.3.0
|
|
18
18
|
|
package/README.md
CHANGED
|
@@ -10,14 +10,13 @@
|
|
|
10
10
|
</a>
|
|
11
11
|
</p>
|
|
12
12
|
<p align="center">
|
|
13
|
-
|
|
13
|
+
A Progressive React Framework for modern web development.
|
|
14
14
|
</p>
|
|
15
15
|
|
|
16
16
|
# Introduction
|
|
17
17
|
|
|
18
18
|
> The doc site ([modernjs.dev](https://modernjs.dev)) and articles are only available in Chinese for now, we are planning to add English versions soon.
|
|
19
19
|
|
|
20
|
-
- [Modern.js: Hello, World!](https://zhuanlan.zhihu.com/p/426707646)
|
|
21
20
|
|
|
22
21
|
## Getting Started
|
|
23
22
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
1
|
+
var _babelJest_createTransformer;
|
|
2
2
|
import babelJest from "babel-jest";
|
|
3
|
-
var babelTransformer = (
|
|
3
|
+
var babelTransformer = (_babelJest_createTransformer = babelJest.createTransformer) === null || _babelJest_createTransformer === void 0 ? void 0 : _babelJest_createTransformer.call(babelJest, {
|
|
4
4
|
presets: [
|
|
5
5
|
[
|
|
6
6
|
require.resolve("@modern-js/babel-preset-app"),
|
|
@@ -186,7 +186,7 @@ function runJest(config) {
|
|
|
186
186
|
}
|
|
187
187
|
function _runJest() {
|
|
188
188
|
_runJest = _asyncToGenerator(function(config) {
|
|
189
|
-
var pwd, argvConfig,
|
|
189
|
+
var pwd, argvConfig, _ref, results, globalConfig, e;
|
|
190
190
|
var _arguments = arguments;
|
|
191
191
|
return __generator(this, function(_state) {
|
|
192
192
|
switch(_state.label){
|
|
@@ -213,7 +213,7 @@ function _runJest() {
|
|
|
213
213
|
])
|
|
214
214
|
];
|
|
215
215
|
case 3:
|
|
216
|
-
|
|
216
|
+
_ref = _state.sent(), results = _ref.results, globalConfig = _ref.globalConfig;
|
|
217
217
|
readResultsAndExit(results, globalConfig);
|
|
218
218
|
return [
|
|
219
219
|
3,
|
|
@@ -157,7 +157,7 @@ import { bff_info_key } from "./constant";
|
|
|
157
157
|
import { isBFFProject } from "./utils";
|
|
158
158
|
var setJestConfigForBFF = function() {
|
|
159
159
|
var _ref = _asyncToGenerator(function(param) {
|
|
160
|
-
var pwd, userConfig, plugins, routes, utils,
|
|
160
|
+
var pwd, userConfig, plugins, routes, utils, _userConfig_source, bffConfig, jestConfig, alias, aliasMapper, moduleNameMapper, transform, apiOnly, mergedModuleNameMapper, resolver, configFields, commonConfig;
|
|
161
161
|
return __generator(this, function(_state) {
|
|
162
162
|
switch(_state.label){
|
|
163
163
|
case 0:
|
|
@@ -185,7 +185,7 @@ var setJestConfigForBFF = function() {
|
|
|
185
185
|
})
|
|
186
186
|
};
|
|
187
187
|
jestConfig = utils.jestConfig;
|
|
188
|
-
alias = (userConfig === null || userConfig === void 0 ? void 0 : (
|
|
188
|
+
alias = (userConfig === null || userConfig === void 0 ? void 0 : (_userConfig_source = userConfig.source) === null || _userConfig_source === void 0 ? void 0 : _userConfig_source.alias) || {};
|
|
189
189
|
aliasMapper = getModuleNameMapper(alias);
|
|
190
190
|
moduleNameMapper = jestConfig.moduleNameMapper;
|
|
191
191
|
transform = {
|
|
@@ -142,7 +142,7 @@ var mockAPI_default = function(mockApiInfosByFile) {
|
|
|
142
142
|
var _info;
|
|
143
143
|
return (_info = info).handler.apply(_info, _toConsumableArray(args));
|
|
144
144
|
}
|
|
145
|
-
var
|
|
145
|
+
var _mock_getParamsAndPayload = _slicedToArray(mock_getParamsAndPayload(args), 2), params = _mock_getParamsAndPayload[0], payload = _mock_getParamsAndPayload[1];
|
|
146
146
|
var returnHttp = module[info.name].returnHttp;
|
|
147
147
|
var url = mock_replaceUrlWithParams(info.routePath, params, payload.params);
|
|
148
148
|
var app = mockAppModule.getApp();
|
|
@@ -129,13 +129,13 @@ import mockAPI from "./mockAPI";
|
|
|
129
129
|
import { createApp, closeServer } from "./app";
|
|
130
130
|
var uped = false;
|
|
131
131
|
var setup = function() {
|
|
132
|
-
var
|
|
132
|
+
var _bff_info_modernUserConfig, _bff_info_modernUserConfig_bff;
|
|
133
133
|
if (uped) {
|
|
134
134
|
return;
|
|
135
135
|
}
|
|
136
136
|
uped = true;
|
|
137
137
|
var bff_info = global[bff_info_key];
|
|
138
|
-
var prefix = bff_info === null || bff_info === void 0 ? void 0 : (
|
|
138
|
+
var prefix = bff_info === null || bff_info === void 0 ? void 0 : (_bff_info_modernUserConfig = bff_info.modernUserConfig) === null || _bff_info_modernUserConfig === void 0 ? void 0 : (_bff_info_modernUserConfig_bff = _bff_info_modernUserConfig.bff) === null || _bff_info_modernUserConfig_bff === void 0 ? void 0 : _bff_info_modernUserConfig_bff.prefix;
|
|
139
139
|
var apiRouter = new ApiRouter({
|
|
140
140
|
apiDir: path.join(bff_info.appDir, "./api"),
|
|
141
141
|
prefix: prefix
|
|
@@ -127,18 +127,18 @@ import { compiler } from "@modern-js/babel-compiler";
|
|
|
127
127
|
import { runTest } from "../base";
|
|
128
128
|
var test = function() {
|
|
129
129
|
var _ref = _asyncToGenerator(function(api) {
|
|
130
|
-
var
|
|
130
|
+
var _userConfig_tools, _userConfig_tools1, userConfig, appContext, jest, runtimeExportsPath;
|
|
131
131
|
return __generator(this, function(_state) {
|
|
132
132
|
switch(_state.label){
|
|
133
133
|
case 0:
|
|
134
134
|
userConfig = api.useResolvedConfigContext();
|
|
135
135
|
appContext = api.useAppContext();
|
|
136
136
|
userConfig.testing = userConfig.testing || {};
|
|
137
|
-
jest = userConfig.testing.jest || (userConfig === null || userConfig === void 0 ? void 0 : (
|
|
137
|
+
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);
|
|
138
138
|
if (Array.isArray(jest)) {
|
|
139
139
|
userConfig.testing.jest = jest[0];
|
|
140
140
|
}
|
|
141
|
-
userConfig.testing.jest = userConfig.testing.jest || (userConfig === null || userConfig === void 0 ? void 0 : (
|
|
141
|
+
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);
|
|
142
142
|
runtimeExportsPath = path.join(appContext.internalDirectory, ".runtime-exports");
|
|
143
143
|
return [
|
|
144
144
|
4,
|
|
@@ -65,12 +65,12 @@ var ModernRuntime = /*#__PURE__*/ function() {
|
|
|
65
65
|
{
|
|
66
66
|
key: "createApp",
|
|
67
67
|
value: function createApp1(props) {
|
|
68
|
-
var
|
|
69
|
-
var
|
|
70
|
-
var runtimeFeatures = (
|
|
68
|
+
var _this_options;
|
|
69
|
+
var _ref = props || {}, entry = _ref.entry, children = _ref.children;
|
|
70
|
+
var runtimeFeatures = (_this_options = this.options) === null || _this_options === void 0 ? void 0 : _this_options.runtime;
|
|
71
71
|
if (entry) {
|
|
72
|
-
var
|
|
73
|
-
runtimeFeatures = _objectSpread({}, runtimeFeatures || {}, (
|
|
72
|
+
var _this_options_runtimeByEntries;
|
|
73
|
+
runtimeFeatures = _objectSpread({}, runtimeFeatures || {}, (_this_options_runtimeByEntries = this.options.runtimeByEntries) === null || _this_options_runtimeByEntries === void 0 ? void 0 : _this_options_runtimeByEntries[entry]);
|
|
74
74
|
}
|
|
75
75
|
var Component = function() {
|
|
76
76
|
if (!children) {
|
|
@@ -66,9 +66,9 @@ var autoActions = function() {
|
|
|
66
66
|
};
|
|
67
67
|
var createStore = function(props) {
|
|
68
68
|
var createStatePlugins = function() {
|
|
69
|
-
var
|
|
69
|
+
var _modernConfig_runtime;
|
|
70
70
|
var modernConfig = global[MODERNJS_CONFIG_KEY];
|
|
71
|
-
var stateConfig = modernConfig === null || modernConfig === void 0 ? void 0 : (
|
|
71
|
+
var stateConfig = modernConfig === null || modernConfig === void 0 ? void 0 : (_modernConfig_runtime = modernConfig.runtime) === null || _modernConfig_runtime === void 0 ? void 0 : _modernConfig_runtime.state;
|
|
72
72
|
var plugins = [];
|
|
73
73
|
if ((stateConfig === null || stateConfig === void 0 ? void 0 : stateConfig.effects) !== false) {
|
|
74
74
|
plugins.push(effects());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modern-js/plugin-testing",
|
|
3
|
-
"description": "
|
|
3
|
+
"description": "A Progressive React Framework for modern web development.",
|
|
4
4
|
"homepage": "https://modernjs.dev",
|
|
5
5
|
"bugs": "https://github.com/modern-js-dev/modern.js/issues",
|
|
6
6
|
"repository": "modern-js-dev/modern.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "0.0.0-next-
|
|
14
|
+
"version": "0.0.0-next-20230206053555",
|
|
15
15
|
"jsnext:source": "./src/cli/index.ts",
|
|
16
16
|
"types": "./dist/types/cli/index.d.ts",
|
|
17
17
|
"main": "./dist/js/node/cli/index.js",
|
|
@@ -107,16 +107,16 @@
|
|
|
107
107
|
"jest": "^27.0.6",
|
|
108
108
|
"ts-jest": "^27.0.4",
|
|
109
109
|
"yargs": "^17.0.1",
|
|
110
|
-
"@modern-js/babel-
|
|
111
|
-
"@modern-js/utils": "0.0.0-next-
|
|
112
|
-
"@modern-js/babel-
|
|
113
|
-
"@modern-js/plugin": "0.0.0-next-
|
|
114
|
-
"@modern-js/prod-server": "0.0.0-next-
|
|
110
|
+
"@modern-js/babel-preset-app": "0.0.0-next-20230206053555",
|
|
111
|
+
"@modern-js/utils": "0.0.0-next-20230206053555",
|
|
112
|
+
"@modern-js/babel-compiler": "0.0.0-next-20230206053555",
|
|
113
|
+
"@modern-js/plugin": "0.0.0-next-20230206053555",
|
|
114
|
+
"@modern-js/prod-server": "0.0.0-next-20230206053555"
|
|
115
115
|
},
|
|
116
116
|
"peerDependencies": {
|
|
117
117
|
"react": ">=17",
|
|
118
118
|
"react-dom": ">=17",
|
|
119
|
-
"@modern-js/runtime": "
|
|
119
|
+
"@modern-js/runtime": "0.0.0-next-20230206053555"
|
|
120
120
|
},
|
|
121
121
|
"peerDependenciesMeta": {
|
|
122
122
|
"@modern-js/runtime": {
|
|
@@ -133,12 +133,12 @@
|
|
|
133
133
|
"@jest/types": "^27.0.6",
|
|
134
134
|
"jest": "^27",
|
|
135
135
|
"typescript": "^4",
|
|
136
|
-
"@modern-js/core": "0.0.0-next-
|
|
137
|
-
"@modern-js/types": "0.0.0-next-
|
|
138
|
-
"@modern-js/runtime": "0.0.0-next-
|
|
139
|
-
"@modern-js/bff-core": "0.0.0-next-
|
|
140
|
-
"@scripts/build": "0.0.0-next-
|
|
141
|
-
"@scripts/jest-config": "0.0.0-next-
|
|
136
|
+
"@modern-js/core": "0.0.0-next-20230206053555",
|
|
137
|
+
"@modern-js/types": "0.0.0-next-20230206053555",
|
|
138
|
+
"@modern-js/runtime": "0.0.0-next-20230206053555",
|
|
139
|
+
"@modern-js/bff-core": "0.0.0-next-20230206053555",
|
|
140
|
+
"@scripts/build": "0.0.0-next-20230206053555",
|
|
141
|
+
"@scripts/jest-config": "0.0.0-next-20230206053555"
|
|
142
142
|
},
|
|
143
143
|
"sideEffects": false,
|
|
144
144
|
"modernConfig": {},
|