@modern-js/plugin-testing 2.5.0 → 2.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/CHANGELOG.md +49 -0
- package/dist/cjs/base/config/index.js +4 -0
- package/dist/cjs/base/config/patches/assetsModule.js +4 -0
- package/dist/cjs/base/config/patches/transformer.js +4 -0
- package/dist/cjs/base/config/resolver.js +4 -0
- package/dist/cjs/base/config/transformer/babelTransformer.js +4 -0
- package/dist/cjs/base/runJest.js +4 -0
- package/dist/cjs/base/utils.js +4 -0
- package/dist/cjs/cli/bff/index.js +4 -0
- package/dist/cjs/cli/bff/mockAPI.js +4 -0
- package/dist/cjs/cli/bff/setup.js +8 -2
- package/dist/cjs/cli/bff/utils/index.js +4 -0
- package/dist/cjs/cli/index.js +7 -0
- package/dist/cjs/cli/test.js +4 -0
- package/dist/cjs/runtime-testing/app.js +4 -0
- package/dist/cjs/runtime-testing/base.js +4 -0
- package/dist/cjs/runtime-testing/customRender.js +4 -0
- package/dist/cjs/runtime-testing/reduck.js +4 -0
- package/dist/cjs/runtime-testing/request.js +4 -0
- package/dist/cjs/runtime-testing/resolvePlugins.js +1 -1
- package/dist/esm/cli/bff/setup.js +4 -2
- package/dist/esm/cli/index.js +3 -0
- package/dist/esm-node/cli/bff/setup.js +4 -2
- package/dist/esm-node/cli/index.js +3 -0
- package/dist/esm-node/runtime-testing/resolvePlugins.js +1 -1
- package/package.json +13 -13
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,54 @@
|
|
1
1
|
# @modern-js/plugin-testing
|
2
2
|
|
3
|
+
## 2.7.0
|
4
|
+
|
5
|
+
### Minor Changes
|
6
|
+
|
7
|
+
- 84bfb439b8: feat: support custom apiDir, lambdaDir and style of writing for bff
|
8
|
+
feat: 支持定制 api 目录,lambda 目录,bff 的写法
|
9
|
+
|
10
|
+
### Patch Changes
|
11
|
+
|
12
|
+
- 7fff9020e1: chore: make file naming consistent
|
13
|
+
|
14
|
+
chore: 统一文件命名为小驼峰格式
|
15
|
+
|
16
|
+
- 1eea234fdd: chore: make test files naming consistent
|
17
|
+
|
18
|
+
chore: 统一测试文件命名为小驼峰格式
|
19
|
+
|
20
|
+
- Updated dependencies [0f15fc597c]
|
21
|
+
- Updated dependencies [dcad887024]
|
22
|
+
- Updated dependencies [a4672f7c16]
|
23
|
+
- Updated dependencies [7fff9020e1]
|
24
|
+
- Updated dependencies [1eea234fdd]
|
25
|
+
- Updated dependencies [84bfb439b8]
|
26
|
+
- @modern-js/utils@2.7.0
|
27
|
+
- @modern-js/runtime@2.7.0
|
28
|
+
- @modern-js/babel-preset-app@2.7.0
|
29
|
+
- @modern-js/prod-server@2.7.0
|
30
|
+
- @modern-js/babel-compiler@2.7.0
|
31
|
+
- @modern-js/plugin@2.7.0
|
32
|
+
|
33
|
+
## 2.6.0
|
34
|
+
|
35
|
+
### Patch Changes
|
36
|
+
|
37
|
+
- Updated dependencies [671477d]
|
38
|
+
- Updated dependencies [36164a2]
|
39
|
+
- Updated dependencies [e1f799e]
|
40
|
+
- Updated dependencies [7915ab3]
|
41
|
+
- Updated dependencies [a909ad1]
|
42
|
+
- Updated dependencies [49fa0b1]
|
43
|
+
- Updated dependencies [0fe658a]
|
44
|
+
- Updated dependencies [1906d7b]
|
45
|
+
- @modern-js/runtime@2.6.0
|
46
|
+
- @modern-js/prod-server@2.6.0
|
47
|
+
- @modern-js/utils@2.6.0
|
48
|
+
- @modern-js/babel-preset-app@2.6.0
|
49
|
+
- @modern-js/babel-compiler@2.6.0
|
50
|
+
- @modern-js/plugin@2.6.0
|
51
|
+
|
3
52
|
## 2.5.0
|
4
53
|
|
5
54
|
### Patch Changes
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
17
17
|
return to;
|
18
18
|
};
|
19
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.
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
25
|
mod
|
22
26
|
));
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
17
17
|
return to;
|
18
18
|
};
|
19
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.
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
25
|
mod
|
22
26
|
));
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
17
17
|
return to;
|
18
18
|
};
|
19
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.
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
25
|
mod
|
22
26
|
));
|
@@ -13,6 +13,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
13
13
|
return to;
|
14
14
|
};
|
15
15
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
16
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
17
|
+
// file that has been converted to a CommonJS file using a Babel-
|
18
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
19
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
16
20
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
17
21
|
mod
|
18
22
|
));
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
17
17
|
return to;
|
18
18
|
};
|
19
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.
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
25
|
mod
|
22
26
|
));
|
package/dist/cjs/base/runJest.js
CHANGED
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
17
17
|
return to;
|
18
18
|
};
|
19
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.
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
25
|
mod
|
22
26
|
));
|
package/dist/cjs/base/utils.js
CHANGED
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
17
17
|
return to;
|
18
18
|
};
|
19
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.
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
25
|
mod
|
22
26
|
));
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
17
17
|
return to;
|
18
18
|
};
|
19
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.
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
25
|
mod
|
22
26
|
));
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
17
17
|
return to;
|
18
18
|
};
|
19
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.
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
25
|
mod
|
22
26
|
));
|
@@ -13,6 +13,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
13
13
|
return to;
|
14
14
|
};
|
15
15
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
16
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
17
|
+
// file that has been converted to a CommonJS file using a Babel-
|
18
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
19
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
16
20
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
17
21
|
mod
|
18
22
|
));
|
@@ -23,16 +27,18 @@ var import_mockAPI = __toESM(require("./mockAPI"));
|
|
23
27
|
var import_app = require("./app");
|
24
28
|
let uped = false;
|
25
29
|
const setup = () => {
|
26
|
-
var _a, _b;
|
30
|
+
var _a, _b, _c, _d;
|
27
31
|
if (uped) {
|
28
32
|
return;
|
29
33
|
}
|
30
34
|
uped = true;
|
31
35
|
const bff_info = global[import_constant.bff_info_key];
|
32
36
|
const prefix = (_b = (_a = bff_info == null ? void 0 : bff_info.modernUserConfig) == null ? void 0 : _a.bff) == null ? void 0 : _b.prefix;
|
37
|
+
const httpMethodDecider = (_d = (_c = bff_info == null ? void 0 : bff_info.modernUserConfig) == null ? void 0 : _c.bff) == null ? void 0 : _d.httpMethodDecider;
|
33
38
|
const apiRouter = new import_bff_core.ApiRouter({
|
34
39
|
apiDir: import_path.default.join(bff_info.appDir, "./api"),
|
35
|
-
prefix
|
40
|
+
prefix,
|
41
|
+
httpMethodDecider
|
36
42
|
});
|
37
43
|
const apiInfos = apiRouter.getApiHandlers();
|
38
44
|
const apiInfosByFile = apiInfos.reduce(
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
17
17
|
return to;
|
18
18
|
};
|
19
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.
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
25
|
mod
|
22
26
|
));
|
package/dist/cjs/cli/index.js
CHANGED
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
17
17
|
return to;
|
18
18
|
};
|
19
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.
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
25
|
mod
|
22
26
|
));
|
@@ -66,6 +70,8 @@ var cli_default = () => {
|
|
66
70
|
return {
|
67
71
|
source: {
|
68
72
|
alias: {
|
73
|
+
// The module-tools alias configuration is different and more specific than app-tools.
|
74
|
+
// So for the time being, the @ alias is configured here.
|
69
75
|
"@": import_path.default.join(appContext.appDirectory, "src"),
|
70
76
|
"@modern-js/runtime/testing": testingExportsUtils.getPath()
|
71
77
|
}
|
@@ -97,6 +103,7 @@ var cli_default = () => {
|
|
97
103
|
testEnvironment: "jsdom",
|
98
104
|
resolver: import_base.DEFAULT_RESOLVER_PATH,
|
99
105
|
rootDir: appContext.appDirectory || process.cwd(),
|
106
|
+
// testMatch bug on windows, issue: https://github.com/facebook/jest/issues/7914
|
100
107
|
testMatch: [
|
101
108
|
`<rootDir>/src/**/*.test.[jt]s?(x)`,
|
102
109
|
`<rootDir>/tests/**/*.test.[jt]s?(x)`
|
package/dist/cjs/cli/test.js
CHANGED
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
17
17
|
return to;
|
18
18
|
};
|
19
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.
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
25
|
mod
|
22
26
|
));
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
17
17
|
return to;
|
18
18
|
};
|
19
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.
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
25
|
mod
|
22
26
|
));
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
18
18
|
};
|
19
19
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
20
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.
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
22
26
|
mod
|
23
27
|
));
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
17
17
|
return to;
|
18
18
|
};
|
19
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.
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
25
|
mod
|
22
26
|
));
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
17
17
|
return to;
|
18
18
|
};
|
19
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.
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
25
|
mod
|
22
26
|
));
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
17
17
|
return to;
|
18
18
|
};
|
19
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.
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
25
|
mod
|
22
26
|
));
|
@@ -28,7 +28,7 @@ function resolvePlugins(features) {
|
|
28
28
|
}
|
29
29
|
Object.keys(features).forEach((feature) => {
|
30
30
|
if (allowedFeatures.includes(feature)) {
|
31
|
-
const curPluginRes = require(
|
31
|
+
const curPluginRes = require("@modern-js/runtime/plugins")[feature]({
|
32
32
|
...features[feature]
|
33
33
|
});
|
34
34
|
plugins.push(curPluginRes);
|
@@ -129,16 +129,18 @@ import mockAPI from "./mockAPI";
|
|
129
129
|
import { createApp, closeServer } from "./app";
|
130
130
|
var uped = false;
|
131
131
|
var setup = function() {
|
132
|
-
var _bff_info_modernUserConfig, _bff_info_modernUserConfig_bff;
|
132
|
+
var _bff_info_modernUserConfig, _bff_info_modernUserConfig_bff, _bff_info_modernUserConfig1, _bff_info_modernUserConfig_bff1;
|
133
133
|
if (uped) {
|
134
134
|
return;
|
135
135
|
}
|
136
136
|
uped = true;
|
137
137
|
var bff_info = global[bff_info_key];
|
138
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
|
+
var httpMethodDecider = bff_info === null || bff_info === void 0 ? void 0 : (_bff_info_modernUserConfig1 = bff_info.modernUserConfig) === null || _bff_info_modernUserConfig1 === void 0 ? void 0 : (_bff_info_modernUserConfig_bff1 = _bff_info_modernUserConfig1.bff) === null || _bff_info_modernUserConfig_bff1 === void 0 ? void 0 : _bff_info_modernUserConfig_bff1.httpMethodDecider;
|
139
140
|
var apiRouter = new ApiRouter({
|
140
141
|
apiDir: path.join(bff_info.appDir, "./api"),
|
141
|
-
prefix: prefix
|
142
|
+
prefix: prefix,
|
143
|
+
httpMethodDecider: httpMethodDecider
|
142
144
|
});
|
143
145
|
var apiInfos = apiRouter.getApiHandlers();
|
144
146
|
var apiInfosByFile = apiInfos.reduce(function(res, apiInfo) {
|
package/dist/esm/cli/index.js
CHANGED
@@ -189,6 +189,8 @@ var cli_default = function() {
|
|
189
189
|
return {
|
190
190
|
source: {
|
191
191
|
alias: {
|
192
|
+
// The module-tools alias configuration is different and more specific than app-tools.
|
193
|
+
// So for the time being, the @ alias is configured here.
|
192
194
|
"@": path.join(appContext.appDirectory, "src"),
|
193
195
|
"@modern-js/runtime/testing": testingExportsUtils.getPath()
|
194
196
|
}
|
@@ -231,6 +233,7 @@ var cli_default = function() {
|
|
231
233
|
testEnvironment: "jsdom",
|
232
234
|
resolver: DEFAULT_RESOLVER_PATH,
|
233
235
|
rootDir: appContext.appDirectory || process.cwd(),
|
236
|
+
// testMatch bug on windows, issue: https://github.com/facebook/jest/issues/7914
|
234
237
|
testMatch: [
|
235
238
|
"<rootDir>/src/**/*.test.[jt]s?(x)",
|
236
239
|
"<rootDir>/tests/**/*.test.[jt]s?(x)"
|
@@ -5,16 +5,18 @@ import mockAPI from "./mockAPI";
|
|
5
5
|
import { createApp, closeServer } from "./app";
|
6
6
|
let uped = false;
|
7
7
|
const setup = () => {
|
8
|
-
var _a, _b;
|
8
|
+
var _a, _b, _c, _d;
|
9
9
|
if (uped) {
|
10
10
|
return;
|
11
11
|
}
|
12
12
|
uped = true;
|
13
13
|
const bff_info = global[bff_info_key];
|
14
14
|
const prefix = (_b = (_a = bff_info == null ? void 0 : bff_info.modernUserConfig) == null ? void 0 : _a.bff) == null ? void 0 : _b.prefix;
|
15
|
+
const httpMethodDecider = (_d = (_c = bff_info == null ? void 0 : bff_info.modernUserConfig) == null ? void 0 : _c.bff) == null ? void 0 : _d.httpMethodDecider;
|
15
16
|
const apiRouter = new ApiRouter({
|
16
17
|
apiDir: path.join(bff_info.appDir, "./api"),
|
17
|
-
prefix
|
18
|
+
prefix,
|
19
|
+
httpMethodDecider
|
18
20
|
});
|
19
21
|
const apiInfos = apiRouter.getApiHandlers();
|
20
22
|
const apiInfosByFile = apiInfos.reduce(
|
@@ -46,6 +46,8 @@ var cli_default = () => {
|
|
46
46
|
return {
|
47
47
|
source: {
|
48
48
|
alias: {
|
49
|
+
// The module-tools alias configuration is different and more specific than app-tools.
|
50
|
+
// So for the time being, the @ alias is configured here.
|
49
51
|
"@": path.join(appContext.appDirectory, "src"),
|
50
52
|
"@modern-js/runtime/testing": testingExportsUtils.getPath()
|
51
53
|
}
|
@@ -77,6 +79,7 @@ var cli_default = () => {
|
|
77
79
|
testEnvironment: "jsdom",
|
78
80
|
resolver: DEFAULT_RESOLVER_PATH,
|
79
81
|
rootDir: appContext.appDirectory || process.cwd(),
|
82
|
+
// testMatch bug on windows, issue: https://github.com/facebook/jest/issues/7914
|
80
83
|
testMatch: [
|
81
84
|
`<rootDir>/src/**/*.test.[jt]s?(x)`,
|
82
85
|
`<rootDir>/tests/**/*.test.[jt]s?(x)`
|
@@ -6,7 +6,7 @@ function resolvePlugins(features) {
|
|
6
6
|
}
|
7
7
|
Object.keys(features).forEach((feature) => {
|
8
8
|
if (allowedFeatures.includes(feature)) {
|
9
|
-
const curPluginRes = require(
|
9
|
+
const curPluginRes = require("@modern-js/runtime/plugins")[feature]({
|
10
10
|
...features[feature]
|
11
11
|
});
|
12
12
|
plugins.push(curPluginRes);
|
package/package.json
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
"modern",
|
12
12
|
"modern.js"
|
13
13
|
],
|
14
|
-
"version": "2.
|
14
|
+
"version": "2.7.0",
|
15
15
|
"jsnext:source": "./src/cli/index.ts",
|
16
16
|
"types": "./dist/types/cli/index.d.ts",
|
17
17
|
"main": "./dist/cjs/cli/index.js",
|
@@ -106,16 +106,16 @@
|
|
106
106
|
"jest": "^27.0.6",
|
107
107
|
"ts-jest": "^27.0.4",
|
108
108
|
"yargs": "^17.0.1",
|
109
|
-
"@modern-js/babel-compiler": "2.
|
110
|
-
"@modern-js/utils": "2.
|
111
|
-
"@modern-js/babel-preset-app": "2.
|
112
|
-
"@modern-js/plugin": "2.
|
113
|
-
"@modern-js/prod-server": "2.
|
109
|
+
"@modern-js/babel-compiler": "2.7.0",
|
110
|
+
"@modern-js/utils": "2.7.0",
|
111
|
+
"@modern-js/babel-preset-app": "2.7.0",
|
112
|
+
"@modern-js/plugin": "2.7.0",
|
113
|
+
"@modern-js/prod-server": "2.7.0"
|
114
114
|
},
|
115
115
|
"peerDependencies": {
|
116
116
|
"react": ">=17",
|
117
117
|
"react-dom": ">=17",
|
118
|
-
"@modern-js/runtime": "^2.
|
118
|
+
"@modern-js/runtime": "^2.7.0"
|
119
119
|
},
|
120
120
|
"peerDependenciesMeta": {
|
121
121
|
"@modern-js/runtime": {
|
@@ -132,12 +132,12 @@
|
|
132
132
|
"@jest/types": "^27.0.6",
|
133
133
|
"jest": "^27",
|
134
134
|
"typescript": "^4",
|
135
|
-
"@modern-js/core": "2.
|
136
|
-
"@modern-js/types": "2.
|
137
|
-
"@modern-js/runtime": "2.
|
138
|
-
"@modern-js/bff-core": "2.
|
139
|
-
"@scripts/build": "2.
|
140
|
-
"@scripts/jest-config": "2.
|
135
|
+
"@modern-js/core": "2.7.0",
|
136
|
+
"@modern-js/types": "2.7.0",
|
137
|
+
"@modern-js/runtime": "2.7.0",
|
138
|
+
"@modern-js/bff-core": "2.7.0",
|
139
|
+
"@scripts/build": "2.7.0",
|
140
|
+
"@scripts/jest-config": "2.7.0"
|
141
141
|
},
|
142
142
|
"sideEffects": false,
|
143
143
|
"modernConfig": {},
|