@modern-js/plugin-testing 2.0.0-beta.3 → 2.0.0-beta.4
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +77 -0
- package/dist/js/modern/base/config/index.js +29 -9
- package/dist/js/modern/base/config/patches/assetsModule.js +7 -7
- package/dist/js/modern/base/config/patches/filemock.js +4 -1
- package/dist/js/modern/base/config/patches/index.js +30 -7
- package/dist/js/modern/base/config/patches/transformer.js +13 -18
- package/dist/js/modern/base/config/resolver.js +11 -6
- package/dist/js/modern/base/config/testConfigOperator.js +29 -23
- package/dist/js/modern/base/config/transformer/babelTransformer.js +16 -8
- package/dist/js/modern/base/hook.js +10 -5
- package/dist/js/modern/base/index.js +14 -6
- package/dist/js/modern/base/runJest.js +73 -62
- package/dist/js/modern/base/utils.js +40 -23
- package/dist/js/modern/cli/bff/app.js +37 -12
- package/dist/js/modern/cli/bff/constant.js +4 -1
- package/dist/js/modern/cli/bff/index.js +95 -52
- package/dist/js/modern/cli/bff/mockAPI.js +79 -64
- package/dist/js/modern/cli/bff/setup.js +71 -34
- package/dist/js/modern/cli/bff/utils/index.js +31 -15
- package/dist/js/modern/cli/index.js +64 -30
- package/dist/js/modern/cli/test.js +53 -18
- package/dist/js/modern/constant.js +4 -1
- package/dist/js/modern/index.js +3 -3
- package/dist/js/modern/modern-app.env.d.js +0 -0
- package/dist/js/modern/runtime-testing/app.js +25 -14
- package/dist/js/modern/runtime-testing/base.js +7 -3
- package/dist/js/modern/runtime-testing/customRender.js +24 -10
- package/dist/js/modern/runtime-testing/index.js +1 -1
- package/dist/js/modern/runtime-testing/reduck.js +41 -19
- package/dist/js/modern/runtime-testing/request.js +4 -4
- package/dist/js/modern/runtime-testing/resolvePlugins.js +24 -8
- package/dist/js/node/base/config/index.js +56 -18
- package/dist/js/node/base/config/patches/assetsModule.js +30 -12
- package/dist/js/node/base/config/patches/filemock.js +22 -7
- package/dist/js/node/base/config/patches/index.js +50 -15
- package/dist/js/node/base/config/patches/transformer.js +38 -25
- package/dist/js/node/base/config/resolver.js +37 -10
- package/dist/js/node/base/config/testConfigOperator.js +49 -30
- package/dist/js/node/base/config/transformer/babelTransformer.js +40 -15
- package/dist/js/node/base/hook.js +28 -13
- package/dist/js/node/base/index.js +31 -63
- package/dist/js/node/base/runJest.js +99 -71
- package/dist/js/node/base/utils.js +66 -34
- package/dist/js/node/cli/bff/app.js +57 -22
- package/dist/js/node/cli/bff/constant.js +22 -7
- package/dist/js/node/cli/bff/index.js +121 -65
- package/dist/js/node/cli/bff/mockAPI.js +103 -71
- package/dist/js/node/cli/bff/setup.js +100 -38
- package/dist/js/node/cli/bff/utils/index.js +55 -22
- package/dist/js/node/cli/index.js +87 -46
- package/dist/js/node/cli/test.js +79 -27
- package/dist/js/node/constant.js +22 -7
- package/dist/js/node/index.js +19 -18
- package/dist/js/node/modern-app.env.d.js +0 -0
- package/dist/js/node/runtime-testing/app.js +53 -25
- package/dist/js/node/runtime-testing/base.js +30 -33
- package/dist/js/node/runtime-testing/customRender.js +49 -18
- package/dist/js/node/runtime-testing/index.js +18 -27
- package/dist/js/node/runtime-testing/reduck.js +67 -31
- package/dist/js/node/runtime-testing/request.js +32 -13
- package/dist/js/node/runtime-testing/resolvePlugins.js +41 -12
- package/dist/js/treeshaking/base/config/index.js +150 -31
- package/dist/js/treeshaking/base/config/patches/assetsModule.js +9 -11
- package/dist/js/treeshaking/base/config/patches/filemock.js +2 -1
- package/dist/js/treeshaking/base/config/patches/index.js +221 -64
- package/dist/js/treeshaking/base/config/patches/transformer.js +34 -37
- package/dist/js/treeshaking/base/config/resolver.js +24 -11
- package/dist/js/treeshaking/base/config/testConfigOperator.js +120 -69
- package/dist/js/treeshaking/base/config/transformer/babelTransformer.js +16 -10
- package/dist/js/treeshaking/base/hook.js +8 -7
- package/dist/js/treeshaking/base/index.js +7 -6
- package/dist/js/treeshaking/base/runJest.js +281 -164
- package/dist/js/treeshaking/base/types/index.js +1 -0
- package/dist/js/treeshaking/base/utils.js +72 -48
- package/dist/js/treeshaking/cli/bff/app.js +192 -68
- package/dist/js/treeshaking/cli/bff/constant.js +2 -1
- package/dist/js/treeshaking/cli/bff/index.js +291 -130
- package/dist/js/treeshaking/cli/bff/mockAPI.js +181 -91
- package/dist/js/treeshaking/cli/bff/setup.js +185 -59
- package/dist/js/treeshaking/cli/bff/utils/index.js +47 -21
- package/dist/js/treeshaking/cli/index.js +248 -108
- package/dist/js/treeshaking/cli/test.js +177 -44
- package/dist/js/treeshaking/constant.js +2 -1
- package/dist/js/treeshaking/index.js +3 -3
- package/dist/js/treeshaking/modern-app.env.d.js +1 -0
- package/dist/js/treeshaking/runtime-testing/app.js +85 -39
- package/dist/js/treeshaking/runtime-testing/base.js +4 -3
- package/dist/js/treeshaking/runtime-testing/customRender.js +38 -10
- package/dist/js/treeshaking/runtime-testing/index.js +1 -1
- package/dist/js/treeshaking/runtime-testing/reduck.js +85 -33
- package/dist/js/treeshaking/runtime-testing/request.js +49 -19
- package/dist/js/treeshaking/runtime-testing/resolvePlugins.js +45 -14
- package/dist/types/base/config/index.d.ts +1 -0
- package/dist/types/base/config/patches/assetsModule.d.ts +1 -0
- package/dist/types/base/config/patches/filemock.d.ts +1 -0
- package/dist/types/base/config/patches/transformer.d.ts +1 -0
- package/dist/types/base/config/resolver.d.ts +2 -1
- package/dist/types/base/config/testConfigOperator.d.ts +2 -0
- package/dist/types/base/runJest.d.ts +2 -0
- package/dist/types/base/utils.d.ts +1 -0
- package/dist/types/cli/bff/index.d.ts +2 -0
- package/dist/types/cli/bff/mockAPI.d.ts +1 -0
- package/dist/types/cli/index.d.ts +2 -0
- package/dist/types/runtime-testing/app.d.ts +3 -0
- package/dist/types/runtime-testing/customRender.d.ts +2 -0
- package/package.json +13 -13
@@ -1,18 +1,36 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
Object.
|
4
|
-
|
1
|
+
var __create = Object.create;
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
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
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
|
+
mod
|
22
|
+
));
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
24
|
+
var stdin_exports = {};
|
25
|
+
__export(stdin_exports, {
|
26
|
+
patchAssetsModule: () => patchAssetsModule
|
5
27
|
});
|
6
|
-
exports
|
7
|
-
|
8
|
-
* Merge config from testConfig.jest
|
9
|
-
*/
|
10
|
-
const patchAssetsModule = testOperator => {
|
28
|
+
module.exports = __toCommonJS(stdin_exports);
|
29
|
+
const patchAssetsModule = (testOperator) => {
|
11
30
|
testOperator.mergeJestConfig({
|
12
31
|
moduleNameMapper: {
|
13
|
-
|
14
|
-
|
32
|
+
"\\.(css|less|scss|sass)$": require.resolve("identity-obj-proxy"),
|
33
|
+
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": require.resolve("./filemock.js")
|
15
34
|
}
|
16
35
|
});
|
17
36
|
};
|
18
|
-
exports.patchAssetsModule = patchAssetsModule;
|
@@ -1,8 +1,23 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
Object.
|
4
|
-
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
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 stdin_exports = {};
|
19
|
+
__export(stdin_exports, {
|
20
|
+
default: () => filemock_default
|
5
21
|
});
|
6
|
-
exports
|
7
|
-
var
|
8
|
-
exports.default = _default;
|
22
|
+
module.exports = __toCommonJS(stdin_exports);
|
23
|
+
var filemock_default = "test-file-stub";
|
@@ -1,18 +1,53 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
Object.
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
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 });
|
12
14
|
}
|
15
|
+
return to;
|
13
16
|
};
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
18
|
+
var stdin_exports = {};
|
19
|
+
__export(stdin_exports, {
|
20
|
+
applyPatches: () => applyPatches
|
21
|
+
});
|
22
|
+
module.exports = __toCommonJS(stdin_exports);
|
23
|
+
var import_transformer = require("./transformer");
|
24
|
+
var import_assetsModule = require("./assetsModule");
|
25
|
+
var __async = (__this, __arguments, generator) => {
|
26
|
+
return new Promise((resolve, reject) => {
|
27
|
+
var fulfilled = (value) => {
|
28
|
+
try {
|
29
|
+
step(generator.next(value));
|
30
|
+
} catch (e) {
|
31
|
+
reject(e);
|
32
|
+
}
|
33
|
+
};
|
34
|
+
var rejected = (value) => {
|
35
|
+
try {
|
36
|
+
step(generator.throw(value));
|
37
|
+
} catch (e) {
|
38
|
+
reject(e);
|
39
|
+
}
|
40
|
+
};
|
41
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
42
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
43
|
+
});
|
17
44
|
};
|
18
|
-
|
45
|
+
const _applyPatches = (patches2, testOperator) => __async(void 0, null, function* () {
|
46
|
+
for (const patch of patches2) {
|
47
|
+
yield patch(testOperator);
|
48
|
+
}
|
49
|
+
});
|
50
|
+
const patches = [import_transformer.patchTransformer, import_assetsModule.patchAssetsModule];
|
51
|
+
const applyPatches = (testConfig) => __async(void 0, null, function* () {
|
52
|
+
yield _applyPatches(patches, testConfig);
|
53
|
+
});
|
@@ -1,50 +1,63 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
Object.
|
4
|
-
|
1
|
+
var __create = Object.create;
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
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
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
|
+
mod
|
22
|
+
));
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
24
|
+
var stdin_exports = {};
|
25
|
+
__export(stdin_exports, {
|
26
|
+
patchTransformer: () => patchTransformer
|
5
27
|
});
|
6
|
-
exports
|
7
|
-
var
|
28
|
+
module.exports = __toCommonJS(stdin_exports);
|
29
|
+
var import_utils = require("../../utils");
|
8
30
|
const resolveTsCompilerOptions = () => {
|
9
|
-
const tsCompilerOptions = (0,
|
10
|
-
const {
|
11
|
-
jsx
|
12
|
-
} = tsCompilerOptions;
|
31
|
+
const tsCompilerOptions = (0, import_utils.readCompilerOptions)() || {};
|
32
|
+
const { jsx } = tsCompilerOptions;
|
13
33
|
if (!jsx) {
|
14
34
|
return null;
|
15
35
|
}
|
16
|
-
tsCompilerOptions.jsx =
|
36
|
+
tsCompilerOptions.jsx = "react-jsx";
|
17
37
|
return tsCompilerOptions;
|
18
38
|
};
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
*/
|
23
|
-
const patchTransformer = testOperator => {
|
24
|
-
const {
|
25
|
-
transformer
|
26
|
-
} = testOperator.testConfig;
|
27
|
-
if (transformer === 'babel-jest') {
|
39
|
+
const patchTransformer = (testOperator) => {
|
40
|
+
const { transformer } = testOperator.testConfig;
|
41
|
+
if (transformer === "babel-jest") {
|
28
42
|
testOperator.mergeJestConfig({
|
29
43
|
transform: {
|
30
|
-
|
44
|
+
"\\.[jt]sx?$": require.resolve("../transformer/babelTransformer")
|
31
45
|
}
|
32
46
|
});
|
33
47
|
}
|
34
|
-
if (transformer ===
|
48
|
+
if (transformer === "ts-jest") {
|
35
49
|
testOperator.mergeJestConfig({
|
36
50
|
transform: {
|
37
|
-
|
51
|
+
"\\.[jt]sx?$": require.resolve("ts-jest")
|
38
52
|
}
|
39
53
|
});
|
40
54
|
const compilerOptions = resolveTsCompilerOptions();
|
41
55
|
compilerOptions && testOperator.mergeJestConfig({
|
42
56
|
globals: {
|
43
|
-
|
57
|
+
"ts-jest": {
|
44
58
|
tsconfig: compilerOptions
|
45
59
|
}
|
46
60
|
}
|
47
61
|
});
|
48
62
|
}
|
49
63
|
};
|
50
|
-
exports.patchTransformer = patchTransformer;
|
@@ -1,15 +1,42 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
var
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
var __create = Object.create;
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
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
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
|
+
mod
|
22
|
+
));
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
24
|
+
var stdin_exports = {};
|
25
|
+
__export(stdin_exports, {
|
26
|
+
default: () => resolver_default
|
27
|
+
});
|
28
|
+
module.exports = __toCommonJS(stdin_exports);
|
29
|
+
var import_enhanced_resolve = __toESM(require("enhanced-resolve"));
|
30
|
+
const resolver = import_enhanced_resolve.default.create.sync({
|
31
|
+
conditionNames: ["require", "node", "default"],
|
32
|
+
extensions: [".js", ".json", ".node", ".ts", ".tsx"]
|
8
33
|
});
|
9
|
-
const shouldResolveByEnhance = url => /^@[^/]+\/[^/]+\/.*/.test(url);
|
10
|
-
|
34
|
+
const shouldResolveByEnhance = (url) => /^@[^/]+\/[^/]+\/.*/.test(url);
|
35
|
+
const internalResolve = function(request, options) {
|
11
36
|
if (shouldResolveByEnhance(request)) {
|
12
37
|
return resolver(options.basedir, request);
|
13
38
|
}
|
14
39
|
return options.defaultResolver(request, options);
|
15
|
-
};
|
40
|
+
};
|
41
|
+
module.exports = internalResolve;
|
42
|
+
var resolver_default = internalResolve;
|
@@ -1,28 +1,54 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
Object.
|
4
|
-
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
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 stdin_exports = {};
|
19
|
+
__export(stdin_exports, {
|
20
|
+
TestConfigOperator: () => TestConfigOperator
|
5
21
|
});
|
6
|
-
exports
|
7
|
-
var
|
8
|
-
|
9
|
-
|
10
|
-
|
22
|
+
module.exports = __toCommonJS(stdin_exports);
|
23
|
+
var import_lodash = require("@modern-js/utils/lodash");
|
24
|
+
var __defProp2 = Object.defineProperty;
|
25
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
26
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
27
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
28
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
29
|
+
var __spreadValues = (a, b) => {
|
30
|
+
for (var prop in b || (b = {}))
|
31
|
+
if (__hasOwnProp2.call(b, prop))
|
32
|
+
__defNormalProp(a, prop, b[prop]);
|
33
|
+
if (__getOwnPropSymbols)
|
34
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
35
|
+
if (__propIsEnum.call(b, prop))
|
36
|
+
__defNormalProp(a, prop, b[prop]);
|
37
|
+
}
|
38
|
+
return a;
|
39
|
+
};
|
11
40
|
class TestConfigOperator {
|
12
41
|
constructor(testConfig) {
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
_defineProperty(this, "defaultTestConfig", {
|
17
|
-
transformer: 'babel-jest'
|
18
|
-
});
|
42
|
+
this.defaultTestConfig = {
|
43
|
+
transformer: "babel-jest"
|
44
|
+
};
|
19
45
|
this._testConfig = testConfig;
|
20
46
|
this._jestConfig = {};
|
21
47
|
this.userJestConfig = testConfig.jest;
|
22
48
|
this.initial();
|
23
49
|
}
|
24
50
|
initial() {
|
25
|
-
this._testConfig = (0,
|
51
|
+
this._testConfig = (0, import_lodash.merge)({}, this.defaultTestConfig, this.testConfig);
|
26
52
|
}
|
27
53
|
get jestConfig() {
|
28
54
|
return this._jestConfig;
|
@@ -31,39 +57,32 @@ class TestConfigOperator {
|
|
31
57
|
return this._testConfig;
|
32
58
|
}
|
33
59
|
mergeJestConfig(sourceConfig) {
|
34
|
-
this._jestConfig = (0,
|
60
|
+
this._jestConfig = (0, import_lodash.merge)({}, this._jestConfig, sourceConfig);
|
35
61
|
}
|
36
62
|
setJestUserConfig() {
|
37
|
-
const {
|
38
|
-
|
39
|
-
} = this;
|
40
|
-
if (typeof userJestConfig === 'object') {
|
63
|
+
const { userJestConfig } = this;
|
64
|
+
if (typeof userJestConfig === "object") {
|
41
65
|
this.setJestConfig(userJestConfig);
|
42
66
|
}
|
43
67
|
}
|
44
68
|
setJestConfig(sourceConfig, options) {
|
45
69
|
if (options) {
|
46
|
-
const {
|
47
|
-
force
|
48
|
-
} = options;
|
70
|
+
const { force } = options;
|
49
71
|
if (force) {
|
50
72
|
this._jestConfig = sourceConfig;
|
51
73
|
return;
|
52
74
|
}
|
53
75
|
}
|
54
|
-
this._jestConfig =
|
76
|
+
this._jestConfig = __spreadValues(__spreadValues({}, this._jestConfig), sourceConfig);
|
55
77
|
}
|
56
78
|
getFinalConfig() {
|
57
|
-
const {
|
58
|
-
userJestConfig
|
59
|
-
} = this;
|
79
|
+
const { userJestConfig } = this;
|
60
80
|
if (!userJestConfig) {
|
61
81
|
return this._jestConfig;
|
62
82
|
}
|
63
|
-
if (typeof userJestConfig ===
|
83
|
+
if (typeof userJestConfig === "function") {
|
64
84
|
return userJestConfig(this._jestConfig);
|
65
85
|
}
|
66
86
|
return this.jestConfig;
|
67
87
|
}
|
68
88
|
}
|
69
|
-
exports.TestConfigOperator = TestConfigOperator;
|
@@ -1,19 +1,44 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
Object.
|
4
|
-
|
1
|
+
var __create = Object.create;
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
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
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
|
+
mod
|
22
|
+
));
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
24
|
+
var stdin_exports = {};
|
25
|
+
__export(stdin_exports, {
|
26
|
+
default: () => babelTransformer_default
|
5
27
|
});
|
6
|
-
exports
|
7
|
-
var
|
8
|
-
var
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
28
|
+
module.exports = __toCommonJS(stdin_exports);
|
29
|
+
var import_babel_jest = __toESM(require("babel-jest"));
|
30
|
+
var _a, _b;
|
31
|
+
const babelTransformer = (_b = (_a = import_babel_jest.default).createTransformer) == null ? void 0 : _b.call(_a, {
|
32
|
+
presets: [
|
33
|
+
[
|
34
|
+
require.resolve("@modern-js/babel-preset-app"),
|
35
|
+
{
|
36
|
+
appDirectory: process.cwd(),
|
37
|
+
modules: "cjs"
|
38
|
+
}
|
39
|
+
]
|
40
|
+
],
|
15
41
|
configFile: false,
|
16
42
|
babelrc: false
|
17
43
|
});
|
18
|
-
var
|
19
|
-
exports.default = _default;
|
44
|
+
var babelTransformer_default = babelTransformer;
|
@@ -1,16 +1,31 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
Object.
|
4
|
-
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
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 stdin_exports = {};
|
19
|
+
__export(stdin_exports, {
|
20
|
+
afterTestHook: () => afterTestHook,
|
21
|
+
jestConfigHook: () => jestConfigHook,
|
22
|
+
testingHooks: () => testingHooks
|
5
23
|
});
|
6
|
-
|
7
|
-
var
|
8
|
-
const jestConfigHook = (0,
|
9
|
-
|
10
|
-
const afterTestHook = (0, _plugin.createParallelWorkflow)();
|
11
|
-
exports.afterTestHook = afterTestHook;
|
24
|
+
module.exports = __toCommonJS(stdin_exports);
|
25
|
+
var import_plugin = require("@modern-js/plugin");
|
26
|
+
const jestConfigHook = (0, import_plugin.createAsyncPipeline)();
|
27
|
+
const afterTestHook = (0, import_plugin.createParallelWorkflow)();
|
12
28
|
const testingHooks = {
|
13
|
-
jestConfig: (0,
|
14
|
-
afterTest: (0,
|
29
|
+
jestConfig: (0, import_plugin.createAsyncPipeline)(),
|
30
|
+
afterTest: (0, import_plugin.createParallelWorkflow)()
|
15
31
|
};
|
16
|
-
exports.testingHooks = testingHooks;
|
@@ -1,66 +1,34 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
Object.
|
4
|
-
|
5
|
-
|
6
|
-
var
|
7
|
-
|
8
|
-
runJest: true,
|
9
|
-
getModuleNameMapper: true,
|
10
|
-
DEFAULT_RESOLVER_PATH: true,
|
11
|
-
TestConfigOperator: true,
|
12
|
-
testingHooks: true
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
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 });
|
13
8
|
};
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
});
|
20
|
-
Object.defineProperty(exports, "TestConfigOperator", {
|
21
|
-
enumerable: true,
|
22
|
-
get: function () {
|
23
|
-
return _testConfigOperator.TestConfigOperator;
|
24
|
-
}
|
25
|
-
});
|
26
|
-
Object.defineProperty(exports, "getModuleNameMapper", {
|
27
|
-
enumerable: true,
|
28
|
-
get: function () {
|
29
|
-
return _utils.getModuleNameMapper;
|
30
|
-
}
|
31
|
-
});
|
32
|
-
Object.defineProperty(exports, "runJest", {
|
33
|
-
enumerable: true,
|
34
|
-
get: function () {
|
35
|
-
return _runJest.runJest;
|
36
|
-
}
|
37
|
-
});
|
38
|
-
Object.defineProperty(exports, "runTest", {
|
39
|
-
enumerable: true,
|
40
|
-
get: function () {
|
41
|
-
return _runJest.runTest;
|
42
|
-
}
|
43
|
-
});
|
44
|
-
Object.defineProperty(exports, "testingHooks", {
|
45
|
-
enumerable: true,
|
46
|
-
get: function () {
|
47
|
-
return _hook.testingHooks;
|
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 });
|
48
14
|
}
|
15
|
+
return to;
|
16
|
+
};
|
17
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
+
var stdin_exports = {};
|
20
|
+
__export(stdin_exports, {
|
21
|
+
DEFAULT_RESOLVER_PATH: () => import_config.DEFAULT_RESOLVER_PATH,
|
22
|
+
TestConfigOperator: () => import_testConfigOperator.TestConfigOperator,
|
23
|
+
getModuleNameMapper: () => import_utils.getModuleNameMapper,
|
24
|
+
runJest: () => import_runJest.runJest,
|
25
|
+
runTest: () => import_runJest.runTest,
|
26
|
+
testingHooks: () => import_hook.testingHooks
|
49
27
|
});
|
50
|
-
|
51
|
-
var
|
52
|
-
var
|
53
|
-
var
|
54
|
-
var
|
55
|
-
var
|
56
|
-
|
57
|
-
if (key === "default" || key === "__esModule") return;
|
58
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
59
|
-
if (key in exports && exports[key] === _types[key]) return;
|
60
|
-
Object.defineProperty(exports, key, {
|
61
|
-
enumerable: true,
|
62
|
-
get: function () {
|
63
|
-
return _types[key];
|
64
|
-
}
|
65
|
-
});
|
66
|
-
});
|
28
|
+
module.exports = __toCommonJS(stdin_exports);
|
29
|
+
var import_runJest = require("./runJest");
|
30
|
+
var import_utils = require("./utils");
|
31
|
+
var import_config = require("./config");
|
32
|
+
var import_testConfigOperator = require("./config/testConfigOperator");
|
33
|
+
var import_hook = require("./hook");
|
34
|
+
__reExport(stdin_exports, require("./types"), module.exports);
|