@modern-js/plugin-testing 2.21.2-alpha.1 → 2.22.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 +27 -0
- package/package.json +13 -13
- package/dist/js/modern/base/config/index.js +0 -36
- package/dist/js/modern/base/config/patches/assetsModule.js +0 -11
- package/dist/js/modern/base/config/patches/filemock.js +0 -4
- package/dist/js/modern/base/config/patches/index.js +0 -34
- package/dist/js/modern/base/config/patches/transformer.js +0 -38
- package/dist/js/modern/base/config/resolver.js +0 -21
- package/dist/js/modern/base/config/testConfigOperator.js +0 -69
- package/dist/js/modern/base/config/transformer/babelTransformer.js +0 -19
- package/dist/js/modern/base/hook.js +0 -12
- package/dist/js/modern/base/index.js +0 -14
- package/dist/js/modern/base/runJest.js +0 -102
- package/dist/js/modern/base/types/index.js +0 -0
- package/dist/js/modern/base/utils.js +0 -66
- package/dist/js/modern/cli/bff/app.js +0 -58
- package/dist/js/modern/cli/bff/constant.js +0 -4
- package/dist/js/modern/cli/bff/index.js +0 -149
- package/dist/js/modern/cli/bff/mockAPI.js +0 -109
- package/dist/js/modern/cli/bff/setup.js +0 -75
- package/dist/js/modern/cli/bff/utils/index.js +0 -37
- package/dist/js/modern/cli/index.js +0 -115
- package/dist/js/modern/cli/test.js +0 -61
- package/dist/js/modern/constant.js +0 -4
- package/dist/js/modern/index.js +0 -3
- package/dist/js/modern/runtime-testing/app.js +0 -48
- package/dist/js/modern/runtime-testing/base.js +0 -7
- package/dist/js/modern/runtime-testing/customRender.js +0 -25
- package/dist/js/modern/runtime-testing/index.js +0 -2
- package/dist/js/modern/runtime-testing/reduck.js +0 -55
- package/dist/js/modern/runtime-testing/request.js +0 -16
- package/dist/js/modern/runtime-testing/resolvePlugins.js +0 -33
- package/dist/js/node/base/config/index.js +0 -67
- package/dist/js/node/base/config/patches/assetsModule.js +0 -40
- package/dist/js/node/base/config/patches/filemock.js +0 -25
- package/dist/js/node/base/config/patches/index.js +0 -57
- package/dist/js/node/base/config/patches/transformer.js +0 -67
- package/dist/js/node/base/config/resolver.js +0 -30
- package/dist/js/node/base/config/testConfigOperator.js +0 -90
- package/dist/js/node/base/config/transformer/babelTransformer.js +0 -46
- package/dist/js/node/base/hook.js +0 -37
- package/dist/js/node/base/index.js +0 -43
- package/dist/js/node/base/runJest.js +0 -132
- package/dist/js/node/base/types/index.js +0 -15
- package/dist/js/node/base/utils.js +0 -95
- package/dist/js/node/cli/bff/app.js +0 -84
- package/dist/js/node/cli/bff/constant.js +0 -27
- package/dist/js/node/cli/bff/index.js +0 -173
- package/dist/js/node/cli/bff/mockAPI.js +0 -134
- package/dist/js/node/cli/bff/setup.js +0 -84
- package/dist/js/node/cli/bff/utils/index.js +0 -64
- package/dist/js/node/cli/index.js +0 -135
- package/dist/js/node/cli/test.js +0 -88
- package/dist/js/node/constant.js +0 -27
- package/dist/js/node/index.js +0 -19
- package/dist/js/node/runtime-testing/app.js +0 -73
- package/dist/js/node/runtime-testing/base.js +0 -38
- package/dist/js/node/runtime-testing/customRender.js +0 -50
- package/dist/js/node/runtime-testing/index.js +0 -18
- package/dist/js/node/runtime-testing/reduck.js +0 -85
- package/dist/js/node/runtime-testing/request.js +0 -45
- package/dist/js/node/runtime-testing/resolvePlugins.js +0 -52
- package/dist/js/treeshaking/base/config/index.js +0 -154
- package/dist/js/treeshaking/base/config/patches/assetsModule.js +0 -9
- package/dist/js/treeshaking/base/config/patches/filemock.js +0 -2
- package/dist/js/treeshaking/base/config/patches/index.js +0 -225
- package/dist/js/treeshaking/base/config/patches/transformer.js +0 -36
- package/dist/js/treeshaking/base/config/resolver.js +0 -37
- package/dist/js/treeshaking/base/config/testConfigOperator.js +0 -127
- package/dist/js/treeshaking/base/config/transformer/babelTransformer.js +0 -17
- package/dist/js/treeshaking/base/hook.js +0 -8
- package/dist/js/treeshaking/base/index.js +0 -7
- package/dist/js/treeshaking/base/runJest.js +0 -292
- package/dist/js/treeshaking/base/types/index.js +0 -1
- package/dist/js/treeshaking/base/utils.js +0 -76
- package/dist/js/treeshaking/cli/bff/app.js +0 -200
- package/dist/js/treeshaking/cli/bff/constant.js +0 -2
- package/dist/js/treeshaking/cli/bff/index.js +0 -297
- package/dist/js/treeshaking/cli/bff/mockAPI.js +0 -188
- package/dist/js/treeshaking/cli/bff/setup.js +0 -192
- package/dist/js/treeshaking/cli/bff/utils/index.js +0 -47
- package/dist/js/treeshaking/cli/index.js +0 -255
- package/dist/js/treeshaking/cli/test.js +0 -180
- package/dist/js/treeshaking/constant.js +0 -2
- package/dist/js/treeshaking/index.js +0 -3
- package/dist/js/treeshaking/runtime-testing/app.js +0 -90
- package/dist/js/treeshaking/runtime-testing/base.js +0 -4
- package/dist/js/treeshaking/runtime-testing/customRender.js +0 -41
- package/dist/js/treeshaking/runtime-testing/index.js +0 -2
- package/dist/js/treeshaking/runtime-testing/reduck.js +0 -89
- package/dist/js/treeshaking/runtime-testing/request.js +0 -51
- package/dist/js/treeshaking/runtime-testing/resolvePlugins.js +0 -46
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
-
var __spreadValues = (a, b) => {
|
|
13
|
-
for (var prop in b || (b = {}))
|
|
14
|
-
if (__hasOwnProp.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
if (__getOwnPropSymbols)
|
|
17
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
-
if (__propIsEnum.call(b, prop))
|
|
19
|
-
__defNormalProp(a, prop, b[prop]);
|
|
20
|
-
}
|
|
21
|
-
return a;
|
|
22
|
-
};
|
|
23
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
-
var __export = (target, all) => {
|
|
25
|
-
for (var name in all)
|
|
26
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
27
|
-
};
|
|
28
|
-
var __copyProps = (to, from, except, desc) => {
|
|
29
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
30
|
-
for (let key of __getOwnPropNames(from))
|
|
31
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
32
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
33
|
-
}
|
|
34
|
-
return to;
|
|
35
|
-
};
|
|
36
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
37
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
38
|
-
mod
|
|
39
|
-
));
|
|
40
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
41
|
-
var reduck_exports = {};
|
|
42
|
-
__export(reduck_exports, {
|
|
43
|
-
autoActions: () => autoActions,
|
|
44
|
-
createStore: () => createStore,
|
|
45
|
-
effects: () => effects,
|
|
46
|
-
immer: () => immer
|
|
47
|
-
});
|
|
48
|
-
module.exports = __toCommonJS(reduck_exports);
|
|
49
|
-
var import_store = require("@modern-js-reduck/store");
|
|
50
|
-
var import_plugin_effects = __toESM(require("@modern-js-reduck/plugin-effects"));
|
|
51
|
-
var import_plugin_auto_actions = __toESM(require("@modern-js-reduck/plugin-auto-actions"));
|
|
52
|
-
var import_plugin_immutable = __toESM(require("@modern-js-reduck/plugin-immutable"));
|
|
53
|
-
var import_constant = require("../constant");
|
|
54
|
-
const effects = () => import_plugin_effects.default;
|
|
55
|
-
const immer = () => import_plugin_immutable.default;
|
|
56
|
-
const autoActions = () => import_plugin_auto_actions.default;
|
|
57
|
-
const createStore = (props) => {
|
|
58
|
-
const createStatePlugins = () => {
|
|
59
|
-
var _a;
|
|
60
|
-
const modernConfig = global[import_constant.MODERNJS_CONFIG_KEY];
|
|
61
|
-
const stateConfig = (_a = modernConfig == null ? void 0 : modernConfig.runtime) == null ? void 0 : _a.state;
|
|
62
|
-
const plugins = [];
|
|
63
|
-
if ((stateConfig == null ? void 0 : stateConfig.effects) !== false) {
|
|
64
|
-
plugins.push(effects());
|
|
65
|
-
}
|
|
66
|
-
if ((stateConfig == null ? void 0 : stateConfig.autoActions) !== false) {
|
|
67
|
-
plugins.push(autoActions());
|
|
68
|
-
}
|
|
69
|
-
if ((stateConfig == null ? void 0 : stateConfig.immer) !== false) {
|
|
70
|
-
plugins.push(immer());
|
|
71
|
-
}
|
|
72
|
-
return ((props == null ? void 0 : props.plugins) || []).concat(plugins);
|
|
73
|
-
};
|
|
74
|
-
const config = __spreadProps(__spreadValues({}, props || {}), {
|
|
75
|
-
plugins: createStatePlugins()
|
|
76
|
-
});
|
|
77
|
-
return (0, import_store.createStore)(config);
|
|
78
|
-
};
|
|
79
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
80
|
-
0 && (module.exports = {
|
|
81
|
-
autoActions,
|
|
82
|
-
createStore,
|
|
83
|
-
effects,
|
|
84
|
-
immer
|
|
85
|
-
});
|
|
@@ -1,45 +0,0 @@
|
|
|
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 request_exports = {};
|
|
25
|
-
__export(request_exports, {
|
|
26
|
-
request: () => request
|
|
27
|
-
});
|
|
28
|
-
module.exports = __toCommonJS(request_exports);
|
|
29
|
-
var import_supertest = __toESM(require("supertest"));
|
|
30
|
-
var import_app = require("../cli/bff/app");
|
|
31
|
-
function request(...args) {
|
|
32
|
-
const [fn, ...extraArgs] = args;
|
|
33
|
-
const app = (0, import_app.getApp)();
|
|
34
|
-
if (!fn) {
|
|
35
|
-
return (0, import_supertest.default)(app);
|
|
36
|
-
}
|
|
37
|
-
fn.returnHttp = true;
|
|
38
|
-
const res = fn(...extraArgs);
|
|
39
|
-
fn.returnHttp = false;
|
|
40
|
-
return res;
|
|
41
|
-
}
|
|
42
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
-
0 && (module.exports = {
|
|
44
|
-
request
|
|
45
|
-
});
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __export = (target, all) => {
|
|
20
|
-
for (var name in all)
|
|
21
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
22
|
-
};
|
|
23
|
-
var __copyProps = (to, from, except, desc) => {
|
|
24
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
25
|
-
for (let key of __getOwnPropNames(from))
|
|
26
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
27
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
28
|
-
}
|
|
29
|
-
return to;
|
|
30
|
-
};
|
|
31
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
|
-
var resolvePlugins_exports = {};
|
|
33
|
-
__export(resolvePlugins_exports, {
|
|
34
|
-
default: () => resolvePlugins
|
|
35
|
-
});
|
|
36
|
-
module.exports = __toCommonJS(resolvePlugins_exports);
|
|
37
|
-
const allowedFeatures = ["router", "state"];
|
|
38
|
-
function resolvePlugins(features) {
|
|
39
|
-
const plugins = [];
|
|
40
|
-
if (!features) {
|
|
41
|
-
return plugins;
|
|
42
|
-
}
|
|
43
|
-
Object.keys(features).forEach((feature) => {
|
|
44
|
-
if (allowedFeatures.includes(feature)) {
|
|
45
|
-
const curPluginRes = require(`@modern-js/runtime/plugins`)[feature](__spreadValues({}, features[feature]));
|
|
46
|
-
plugins.push(curPluginRes);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
return plugins;
|
|
50
|
-
}
|
|
51
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
52
|
-
0 && (module.exports = {});
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2
|
-
try {
|
|
3
|
-
var info = gen[key](arg);
|
|
4
|
-
var value = info.value;
|
|
5
|
-
} catch (error) {
|
|
6
|
-
reject(error);
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
if (info.done) {
|
|
10
|
-
resolve(value);
|
|
11
|
-
} else {
|
|
12
|
-
Promise.resolve(value).then(_next, _throw);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
function _asyncToGenerator(fn) {
|
|
16
|
-
return function() {
|
|
17
|
-
var self = this, args = arguments;
|
|
18
|
-
return new Promise(function(resolve, reject) {
|
|
19
|
-
var gen = fn.apply(self, args);
|
|
20
|
-
function _next(value) {
|
|
21
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
22
|
-
}
|
|
23
|
-
function _throw(err) {
|
|
24
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
25
|
-
}
|
|
26
|
-
_next(undefined);
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
var __generator = this && this.__generator || function(thisArg, body) {
|
|
31
|
-
var f, y, t, g, _ = {
|
|
32
|
-
label: 0,
|
|
33
|
-
sent: function() {
|
|
34
|
-
if (t[0] & 1) throw t[1];
|
|
35
|
-
return t[1];
|
|
36
|
-
},
|
|
37
|
-
trys: [],
|
|
38
|
-
ops: []
|
|
39
|
-
};
|
|
40
|
-
return(g = {
|
|
41
|
-
next: verb(0),
|
|
42
|
-
"throw": verb(1),
|
|
43
|
-
"return": verb(2)
|
|
44
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
45
|
-
return this;
|
|
46
|
-
}), g);
|
|
47
|
-
function verb(n) {
|
|
48
|
-
return function(v) {
|
|
49
|
-
return step([
|
|
50
|
-
n,
|
|
51
|
-
v
|
|
52
|
-
]);
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
function step(op) {
|
|
56
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
57
|
-
while(_)try {
|
|
58
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
59
|
-
if (y = 0, t) op = [
|
|
60
|
-
op[0] & 2,
|
|
61
|
-
t.value
|
|
62
|
-
];
|
|
63
|
-
switch(op[0]){
|
|
64
|
-
case 0:
|
|
65
|
-
case 1:
|
|
66
|
-
t = op;
|
|
67
|
-
break;
|
|
68
|
-
case 4:
|
|
69
|
-
_.label++;
|
|
70
|
-
return {
|
|
71
|
-
value: op[1],
|
|
72
|
-
done: false
|
|
73
|
-
};
|
|
74
|
-
case 5:
|
|
75
|
-
_.label++;
|
|
76
|
-
y = op[1];
|
|
77
|
-
op = [
|
|
78
|
-
0
|
|
79
|
-
];
|
|
80
|
-
continue;
|
|
81
|
-
case 7:
|
|
82
|
-
op = _.ops.pop();
|
|
83
|
-
_.trys.pop();
|
|
84
|
-
continue;
|
|
85
|
-
default:
|
|
86
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
87
|
-
_ = 0;
|
|
88
|
-
continue;
|
|
89
|
-
}
|
|
90
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
91
|
-
_.label = op[1];
|
|
92
|
-
break;
|
|
93
|
-
}
|
|
94
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
95
|
-
_.label = t[1];
|
|
96
|
-
t = op;
|
|
97
|
-
break;
|
|
98
|
-
}
|
|
99
|
-
if (t && _.label < t[2]) {
|
|
100
|
-
_.label = t[2];
|
|
101
|
-
_.ops.push(op);
|
|
102
|
-
break;
|
|
103
|
-
}
|
|
104
|
-
if (t[2]) _.ops.pop();
|
|
105
|
-
_.trys.pop();
|
|
106
|
-
continue;
|
|
107
|
-
}
|
|
108
|
-
op = body.call(thisArg, _);
|
|
109
|
-
} catch (e) {
|
|
110
|
-
op = [
|
|
111
|
-
6,
|
|
112
|
-
e
|
|
113
|
-
];
|
|
114
|
-
y = 0;
|
|
115
|
-
} finally{
|
|
116
|
-
f = t = 0;
|
|
117
|
-
}
|
|
118
|
-
if (op[0] & 5) throw op[1];
|
|
119
|
-
return {
|
|
120
|
-
value: op[0] ? op[1] : void 0,
|
|
121
|
-
done: true
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
import { applyPatches } from "./patches";
|
|
126
|
-
import { TestConfigOperator } from "./testConfigOperator";
|
|
127
|
-
var getJestUtils = function(testConfig) {
|
|
128
|
-
var testOperator = new TestConfigOperator(testConfig);
|
|
129
|
-
return testOperator;
|
|
130
|
-
};
|
|
131
|
-
var patchConfig = function() {
|
|
132
|
-
var _ref = _asyncToGenerator(function(testOperator) {
|
|
133
|
-
return __generator(this, function(_state) {
|
|
134
|
-
switch(_state.label){
|
|
135
|
-
case 0:
|
|
136
|
-
return [
|
|
137
|
-
4,
|
|
138
|
-
applyPatches(testOperator)
|
|
139
|
-
];
|
|
140
|
-
case 1:
|
|
141
|
-
_state.sent();
|
|
142
|
-
return [
|
|
143
|
-
2,
|
|
144
|
-
testOperator.jestConfig
|
|
145
|
-
];
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
|
-
return function patchConfig(testOperator) {
|
|
150
|
-
return _ref.apply(this, arguments);
|
|
151
|
-
};
|
|
152
|
-
}();
|
|
153
|
-
var DEFAULT_RESOLVER_PATH = require.resolve("./resolver");
|
|
154
|
-
export { DEFAULT_RESOLVER_PATH, getJestUtils, patchConfig };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
var patchAssetsModule = function(testOperator) {
|
|
2
|
-
testOperator.mergeJestConfig({
|
|
3
|
-
moduleNameMapper: {
|
|
4
|
-
"\\.(css|less|scss|sass)$": require.resolve("identity-obj-proxy"),
|
|
5
|
-
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": require.resolve("./filemock.js")
|
|
6
|
-
}
|
|
7
|
-
});
|
|
8
|
-
};
|
|
9
|
-
export { patchAssetsModule };
|
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2
|
-
try {
|
|
3
|
-
var info = gen[key](arg);
|
|
4
|
-
var value = info.value;
|
|
5
|
-
} catch (error) {
|
|
6
|
-
reject(error);
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
if (info.done) {
|
|
10
|
-
resolve(value);
|
|
11
|
-
} else {
|
|
12
|
-
Promise.resolve(value).then(_next, _throw);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
function _asyncToGenerator(fn) {
|
|
16
|
-
return function() {
|
|
17
|
-
var self = this, args = arguments;
|
|
18
|
-
return new Promise(function(resolve, reject) {
|
|
19
|
-
var gen = fn.apply(self, args);
|
|
20
|
-
function _next(value) {
|
|
21
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
22
|
-
}
|
|
23
|
-
function _throw(err) {
|
|
24
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
25
|
-
}
|
|
26
|
-
_next(undefined);
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
var __generator = this && this.__generator || function(thisArg, body) {
|
|
31
|
-
var f, y, t, g, _ = {
|
|
32
|
-
label: 0,
|
|
33
|
-
sent: function() {
|
|
34
|
-
if (t[0] & 1) throw t[1];
|
|
35
|
-
return t[1];
|
|
36
|
-
},
|
|
37
|
-
trys: [],
|
|
38
|
-
ops: []
|
|
39
|
-
};
|
|
40
|
-
return(g = {
|
|
41
|
-
next: verb(0),
|
|
42
|
-
"throw": verb(1),
|
|
43
|
-
"return": verb(2)
|
|
44
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
45
|
-
return this;
|
|
46
|
-
}), g);
|
|
47
|
-
function verb(n) {
|
|
48
|
-
return function(v) {
|
|
49
|
-
return step([
|
|
50
|
-
n,
|
|
51
|
-
v
|
|
52
|
-
]);
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
function step(op) {
|
|
56
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
57
|
-
while(_)try {
|
|
58
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
59
|
-
if (y = 0, t) op = [
|
|
60
|
-
op[0] & 2,
|
|
61
|
-
t.value
|
|
62
|
-
];
|
|
63
|
-
switch(op[0]){
|
|
64
|
-
case 0:
|
|
65
|
-
case 1:
|
|
66
|
-
t = op;
|
|
67
|
-
break;
|
|
68
|
-
case 4:
|
|
69
|
-
_.label++;
|
|
70
|
-
return {
|
|
71
|
-
value: op[1],
|
|
72
|
-
done: false
|
|
73
|
-
};
|
|
74
|
-
case 5:
|
|
75
|
-
_.label++;
|
|
76
|
-
y = op[1];
|
|
77
|
-
op = [
|
|
78
|
-
0
|
|
79
|
-
];
|
|
80
|
-
continue;
|
|
81
|
-
case 7:
|
|
82
|
-
op = _.ops.pop();
|
|
83
|
-
_.trys.pop();
|
|
84
|
-
continue;
|
|
85
|
-
default:
|
|
86
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
87
|
-
_ = 0;
|
|
88
|
-
continue;
|
|
89
|
-
}
|
|
90
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
91
|
-
_.label = op[1];
|
|
92
|
-
break;
|
|
93
|
-
}
|
|
94
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
95
|
-
_.label = t[1];
|
|
96
|
-
t = op;
|
|
97
|
-
break;
|
|
98
|
-
}
|
|
99
|
-
if (t && _.label < t[2]) {
|
|
100
|
-
_.label = t[2];
|
|
101
|
-
_.ops.push(op);
|
|
102
|
-
break;
|
|
103
|
-
}
|
|
104
|
-
if (t[2]) _.ops.pop();
|
|
105
|
-
_.trys.pop();
|
|
106
|
-
continue;
|
|
107
|
-
}
|
|
108
|
-
op = body.call(thisArg, _);
|
|
109
|
-
} catch (e) {
|
|
110
|
-
op = [
|
|
111
|
-
6,
|
|
112
|
-
e
|
|
113
|
-
];
|
|
114
|
-
y = 0;
|
|
115
|
-
} finally{
|
|
116
|
-
f = t = 0;
|
|
117
|
-
}
|
|
118
|
-
if (op[0] & 5) throw op[1];
|
|
119
|
-
return {
|
|
120
|
-
value: op[0] ? op[1] : void 0,
|
|
121
|
-
done: true
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
import { patchTransformer } from "./transformer";
|
|
126
|
-
import { patchAssetsModule } from "./assetsModule";
|
|
127
|
-
var _applyPatches = function() {
|
|
128
|
-
var _ref = _asyncToGenerator(function(patches2, testOperator) {
|
|
129
|
-
var _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, patch, err;
|
|
130
|
-
return __generator(this, function(_state) {
|
|
131
|
-
switch(_state.label){
|
|
132
|
-
case 0:
|
|
133
|
-
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
134
|
-
_state.label = 1;
|
|
135
|
-
case 1:
|
|
136
|
-
_state.trys.push([
|
|
137
|
-
1,
|
|
138
|
-
6,
|
|
139
|
-
7,
|
|
140
|
-
8
|
|
141
|
-
]);
|
|
142
|
-
_iterator = patches2[Symbol.iterator]();
|
|
143
|
-
_state.label = 2;
|
|
144
|
-
case 2:
|
|
145
|
-
if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done)) return [
|
|
146
|
-
3,
|
|
147
|
-
5
|
|
148
|
-
];
|
|
149
|
-
patch = _step.value;
|
|
150
|
-
return [
|
|
151
|
-
4,
|
|
152
|
-
patch(testOperator)
|
|
153
|
-
];
|
|
154
|
-
case 3:
|
|
155
|
-
_state.sent();
|
|
156
|
-
_state.label = 4;
|
|
157
|
-
case 4:
|
|
158
|
-
_iteratorNormalCompletion = true;
|
|
159
|
-
return [
|
|
160
|
-
3,
|
|
161
|
-
2
|
|
162
|
-
];
|
|
163
|
-
case 5:
|
|
164
|
-
return [
|
|
165
|
-
3,
|
|
166
|
-
8
|
|
167
|
-
];
|
|
168
|
-
case 6:
|
|
169
|
-
err = _state.sent();
|
|
170
|
-
_didIteratorError = true;
|
|
171
|
-
_iteratorError = err;
|
|
172
|
-
return [
|
|
173
|
-
3,
|
|
174
|
-
8
|
|
175
|
-
];
|
|
176
|
-
case 7:
|
|
177
|
-
try {
|
|
178
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
179
|
-
_iterator.return();
|
|
180
|
-
}
|
|
181
|
-
} finally{
|
|
182
|
-
if (_didIteratorError) {
|
|
183
|
-
throw _iteratorError;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
return [
|
|
187
|
-
7
|
|
188
|
-
];
|
|
189
|
-
case 8:
|
|
190
|
-
return [
|
|
191
|
-
2
|
|
192
|
-
];
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
});
|
|
196
|
-
return function _applyPatches(patches2, testOperator) {
|
|
197
|
-
return _ref.apply(this, arguments);
|
|
198
|
-
};
|
|
199
|
-
}();
|
|
200
|
-
var patches = [
|
|
201
|
-
patchTransformer,
|
|
202
|
-
patchAssetsModule
|
|
203
|
-
];
|
|
204
|
-
var applyPatches = function() {
|
|
205
|
-
var _ref = _asyncToGenerator(function(testConfig) {
|
|
206
|
-
return __generator(this, function(_state) {
|
|
207
|
-
switch(_state.label){
|
|
208
|
-
case 0:
|
|
209
|
-
return [
|
|
210
|
-
4,
|
|
211
|
-
_applyPatches(patches, testConfig)
|
|
212
|
-
];
|
|
213
|
-
case 1:
|
|
214
|
-
_state.sent();
|
|
215
|
-
return [
|
|
216
|
-
2
|
|
217
|
-
];
|
|
218
|
-
}
|
|
219
|
-
});
|
|
220
|
-
});
|
|
221
|
-
return function applyPatches(testConfig) {
|
|
222
|
-
return _ref.apply(this, arguments);
|
|
223
|
-
};
|
|
224
|
-
}();
|
|
225
|
-
export { applyPatches };
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { readCompilerOptions } from "../../utils";
|
|
2
|
-
var resolveTsCompilerOptions = function() {
|
|
3
|
-
var tsCompilerOptions = readCompilerOptions() || {};
|
|
4
|
-
var jsx = tsCompilerOptions.jsx;
|
|
5
|
-
if (!jsx) {
|
|
6
|
-
return null;
|
|
7
|
-
}
|
|
8
|
-
tsCompilerOptions.jsx = "react-jsx";
|
|
9
|
-
return tsCompilerOptions;
|
|
10
|
-
};
|
|
11
|
-
var patchTransformer = function(testOperator) {
|
|
12
|
-
var transformer = testOperator.testConfig.transformer;
|
|
13
|
-
if (transformer === "babel-jest") {
|
|
14
|
-
testOperator.mergeJestConfig({
|
|
15
|
-
transform: {
|
|
16
|
-
"\\.[jt]sx?$": require.resolve("../transformer/babelTransformer")
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
if (transformer === "ts-jest") {
|
|
21
|
-
testOperator.mergeJestConfig({
|
|
22
|
-
transform: {
|
|
23
|
-
"\\.[jt]sx?$": require.resolve("ts-jest")
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
var compilerOptions = resolveTsCompilerOptions();
|
|
27
|
-
compilerOptions && testOperator.mergeJestConfig({
|
|
28
|
-
globals: {
|
|
29
|
-
"ts-jest": {
|
|
30
|
-
tsconfig: compilerOptions
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
export { patchTransformer };
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2
|
-
var __commonJS = function(cb, mod) {
|
|
3
|
-
return function __require() {
|
|
4
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = {
|
|
5
|
-
exports: {}
|
|
6
|
-
}).exports, mod), mod.exports;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
import enhanceResolve from "enhanced-resolve";
|
|
10
|
-
var require_resolver = __commonJS({
|
|
11
|
-
"src/base/config/resolver.ts": function(exports, module) {
|
|
12
|
-
var resolver = enhanceResolve.create.sync({
|
|
13
|
-
conditionNames: [
|
|
14
|
-
"require",
|
|
15
|
-
"node",
|
|
16
|
-
"default"
|
|
17
|
-
],
|
|
18
|
-
extensions: [
|
|
19
|
-
".js",
|
|
20
|
-
".json",
|
|
21
|
-
".node",
|
|
22
|
-
".ts",
|
|
23
|
-
".tsx"
|
|
24
|
-
]
|
|
25
|
-
});
|
|
26
|
-
var shouldResolveByEnhance = function(url) {
|
|
27
|
-
return /^@[^/]+\/[^/]+\/.*/.test(url);
|
|
28
|
-
};
|
|
29
|
-
module.exports = function(request, options) {
|
|
30
|
-
if (shouldResolveByEnhance(request)) {
|
|
31
|
-
return resolver(options.basedir, request);
|
|
32
|
-
}
|
|
33
|
-
return options.defaultResolver(request, options);
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
export default require_resolver();
|