@modern-js/plugin-testing 2.0.0-beta.3 → 2.0.0-beta.6
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 +159 -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 +20 -11
- 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 +65 -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 +62 -18
- package/dist/js/node/base/config/patches/assetsModule.js +34 -12
- package/dist/js/node/base/config/patches/filemock.js +24 -7
- package/dist/js/node/base/config/patches/index.js +54 -15
- package/dist/js/node/base/config/patches/transformer.js +42 -25
- package/dist/js/node/base/config/resolver.js +25 -10
- package/dist/js/node/base/config/testConfigOperator.js +51 -30
- package/dist/js/node/base/config/transformer/babelTransformer.js +42 -15
- package/dist/js/node/base/hook.js +34 -13
- package/dist/js/node/base/index.js +39 -62
- package/dist/js/node/base/runJest.js +104 -71
- package/dist/js/node/base/types/index.js +15 -0
- package/dist/js/node/base/utils.js +70 -34
- package/dist/js/node/cli/bff/app.js +64 -22
- package/dist/js/node/cli/bff/constant.js +26 -7
- package/dist/js/node/cli/bff/index.js +123 -65
- package/dist/js/node/cli/bff/mockAPI.js +103 -71
- package/dist/js/node/cli/bff/setup.js +71 -28
- package/dist/js/node/cli/bff/utils/index.js +57 -22
- package/dist/js/node/cli/index.js +92 -46
- package/dist/js/node/cli/test.js +81 -27
- package/dist/js/node/constant.js +26 -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 +34 -32
- 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 +72 -31
- package/dist/js/node/runtime-testing/request.js +36 -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 +36 -13
- 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 +249 -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/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 +21 -25
|
@@ -1,11 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
import React from "react";
|
|
18
|
+
import { render } from "@testing-library/react";
|
|
6
19
|
import app from "./app";
|
|
7
|
-
const WrapModernProviders = props =>
|
|
8
|
-
const customRender = (ui, options) => render(ui,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
20
|
+
const WrapModernProviders = (props) => React.createElement(app.createApp(props));
|
|
21
|
+
const customRender = (ui, options) => render(ui, __spreadValues({ wrapper: WrapModernProviders }, options));
|
|
22
|
+
var customRender_default = customRender;
|
|
23
|
+
export {
|
|
24
|
+
customRender_default as default
|
|
25
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from "./base";
|
|
2
|
-
export * from "./reduck";
|
|
2
|
+
export * from "./reduck";
|
|
@@ -1,33 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
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 __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
import { createStore as originCreateStore } from "@modern-js-reduck/store";
|
|
21
|
+
import effectsPlugin from "@modern-js-reduck/plugin-effects";
|
|
22
|
+
import autoActionsPlugin from "@modern-js-reduck/plugin-auto-actions";
|
|
23
|
+
import immerPlugin from "@modern-js-reduck/plugin-immutable";
|
|
8
24
|
import { MODERNJS_CONFIG_KEY } from "../constant";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
25
|
+
const effects = () => effectsPlugin;
|
|
26
|
+
const immer = () => immerPlugin;
|
|
27
|
+
const autoActions = () => autoActionsPlugin;
|
|
28
|
+
const createStore = (props) => {
|
|
13
29
|
const createStatePlugins = () => {
|
|
14
|
-
var
|
|
30
|
+
var _a;
|
|
15
31
|
const modernConfig = global[MODERNJS_CONFIG_KEY];
|
|
16
|
-
const stateConfig =
|
|
32
|
+
const stateConfig = (_a = modernConfig == null ? void 0 : modernConfig.runtime) == null ? void 0 : _a.state;
|
|
17
33
|
const plugins = [];
|
|
18
|
-
if ((stateConfig
|
|
34
|
+
if ((stateConfig == null ? void 0 : stateConfig.effects) !== false) {
|
|
19
35
|
plugins.push(effects());
|
|
20
36
|
}
|
|
21
|
-
if ((stateConfig
|
|
37
|
+
if ((stateConfig == null ? void 0 : stateConfig.autoActions) !== false) {
|
|
22
38
|
plugins.push(autoActions());
|
|
23
39
|
}
|
|
24
|
-
if ((stateConfig
|
|
40
|
+
if ((stateConfig == null ? void 0 : stateConfig.immer) !== false) {
|
|
25
41
|
plugins.push(immer());
|
|
26
42
|
}
|
|
27
|
-
return ((props
|
|
43
|
+
return ((props == null ? void 0 : props.plugins) || []).concat(plugins);
|
|
28
44
|
};
|
|
29
|
-
const config =
|
|
45
|
+
const config = __spreadProps(__spreadValues({}, props || {}), {
|
|
30
46
|
plugins: createStatePlugins()
|
|
31
47
|
});
|
|
32
48
|
return originCreateStore(config);
|
|
33
|
-
};
|
|
49
|
+
};
|
|
50
|
+
export {
|
|
51
|
+
autoActions,
|
|
52
|
+
createStore,
|
|
53
|
+
effects,
|
|
54
|
+
immer
|
|
55
|
+
};
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import supertest from 'supertest';
|
|
1
|
+
import supertest from "supertest";
|
|
4
2
|
import { getApp } from "../cli/bff/app";
|
|
5
3
|
function request(...args) {
|
|
6
4
|
const [fn, ...extraArgs] = args;
|
|
@@ -13,4 +11,6 @@ function request(...args) {
|
|
|
13
11
|
fn.returnHttp = false;
|
|
14
12
|
return res;
|
|
15
13
|
}
|
|
16
|
-
export {
|
|
14
|
+
export {
|
|
15
|
+
request
|
|
16
|
+
};
|
|
@@ -1,17 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
const allowedFeatures = ["router", "state"];
|
|
18
|
+
function resolvePlugins(features) {
|
|
6
19
|
const plugins = [];
|
|
7
20
|
if (!features) {
|
|
8
21
|
return plugins;
|
|
9
22
|
}
|
|
10
|
-
Object.keys(features).forEach(feature => {
|
|
23
|
+
Object.keys(features).forEach((feature) => {
|
|
11
24
|
if (allowedFeatures.includes(feature)) {
|
|
12
|
-
const curPluginRes = require(`@modern-js/runtime/plugins`)[feature](
|
|
25
|
+
const curPluginRes = require(`@modern-js/runtime/plugins`)[feature](__spreadValues({}, features[feature]));
|
|
13
26
|
plugins.push(curPluginRes);
|
|
14
27
|
}
|
|
15
28
|
});
|
|
16
29
|
return plugins;
|
|
17
|
-
}
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
resolvePlugins as default
|
|
33
|
+
};
|
|
@@ -1,23 +1,67 @@
|
|
|
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 __async = (__this, __arguments, generator) => {
|
|
25
|
+
return new Promise((resolve, reject) => {
|
|
26
|
+
var fulfilled = (value) => {
|
|
27
|
+
try {
|
|
28
|
+
step(generator.next(value));
|
|
29
|
+
} catch (e) {
|
|
30
|
+
reject(e);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
var rejected = (value) => {
|
|
34
|
+
try {
|
|
35
|
+
step(generator.throw(value));
|
|
36
|
+
} catch (e) {
|
|
37
|
+
reject(e);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
41
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
var config_exports = {};
|
|
45
|
+
__export(config_exports, {
|
|
46
|
+
DEFAULT_RESOLVER_PATH: () => DEFAULT_RESOLVER_PATH,
|
|
47
|
+
getJestUtils: () => getJestUtils,
|
|
48
|
+
patchConfig: () => patchConfig
|
|
5
49
|
});
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*/
|
|
12
|
-
const getJestUtils = testConfig => {
|
|
13
|
-
const testOperator = new _testConfigOperator.TestConfigOperator(testConfig);
|
|
50
|
+
module.exports = __toCommonJS(config_exports);
|
|
51
|
+
var import_patches = require("./patches");
|
|
52
|
+
var import_testConfigOperator = require("./testConfigOperator");
|
|
53
|
+
const getJestUtils = (testConfig) => {
|
|
54
|
+
const testOperator = new import_testConfigOperator.TestConfigOperator(testConfig);
|
|
14
55
|
return testOperator;
|
|
15
56
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
await (0, _patches.applyPatches)(testOperator);
|
|
57
|
+
const patchConfig = (testOperator) => __async(void 0, null, function* () {
|
|
58
|
+
yield (0, import_patches.applyPatches)(testOperator);
|
|
19
59
|
return testOperator.jestConfig;
|
|
20
|
-
};
|
|
21
|
-
exports.patchConfig = patchConfig;
|
|
60
|
+
});
|
|
22
61
|
const DEFAULT_RESOLVER_PATH = require.resolve("./resolver");
|
|
23
|
-
|
|
62
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
63
|
+
0 && (module.exports = {
|
|
64
|
+
DEFAULT_RESOLVER_PATH,
|
|
65
|
+
getJestUtils,
|
|
66
|
+
patchConfig
|
|
67
|
+
});
|
|
@@ -1,18 +1,40 @@
|
|
|
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 assetsModule_exports = {};
|
|
25
|
+
__export(assetsModule_exports, {
|
|
26
|
+
patchAssetsModule: () => patchAssetsModule
|
|
5
27
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
8
|
-
* Merge config from testConfig.jest
|
|
9
|
-
*/
|
|
10
|
-
const patchAssetsModule = testOperator => {
|
|
28
|
+
module.exports = __toCommonJS(assetsModule_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
|
-
|
|
37
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
+
0 && (module.exports = {
|
|
39
|
+
patchAssetsModule
|
|
40
|
+
});
|
|
@@ -1,8 +1,25 @@
|
|
|
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 filemock_exports = {};
|
|
19
|
+
__export(filemock_exports, {
|
|
20
|
+
default: () => filemock_default
|
|
5
21
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
|
|
22
|
+
module.exports = __toCommonJS(filemock_exports);
|
|
23
|
+
var filemock_default = "test-file-stub";
|
|
24
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
25
|
+
0 && (module.exports = {});
|
|
@@ -1,18 +1,57 @@
|
|
|
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 __async = (__this, __arguments, generator) => {
|
|
19
|
+
return new Promise((resolve, reject) => {
|
|
20
|
+
var fulfilled = (value) => {
|
|
21
|
+
try {
|
|
22
|
+
step(generator.next(value));
|
|
23
|
+
} catch (e) {
|
|
24
|
+
reject(e);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
var rejected = (value) => {
|
|
28
|
+
try {
|
|
29
|
+
step(generator.throw(value));
|
|
30
|
+
} catch (e) {
|
|
31
|
+
reject(e);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
35
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
36
|
+
});
|
|
17
37
|
};
|
|
18
|
-
|
|
38
|
+
var patches_exports = {};
|
|
39
|
+
__export(patches_exports, {
|
|
40
|
+
applyPatches: () => applyPatches
|
|
41
|
+
});
|
|
42
|
+
module.exports = __toCommonJS(patches_exports);
|
|
43
|
+
var import_transformer = require("./transformer");
|
|
44
|
+
var import_assetsModule = require("./assetsModule");
|
|
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
|
+
});
|
|
54
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
55
|
+
0 && (module.exports = {
|
|
56
|
+
applyPatches
|
|
57
|
+
});
|
|
@@ -1,50 +1,67 @@
|
|
|
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 transformer_exports = {};
|
|
25
|
+
__export(transformer_exports, {
|
|
26
|
+
patchTransformer: () => patchTransformer
|
|
5
27
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
28
|
+
module.exports = __toCommonJS(transformer_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
|
-
|
|
64
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
65
|
+
0 && (module.exports = {
|
|
66
|
+
patchTransformer
|
|
67
|
+
});
|
|
@@ -1,15 +1,30 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
8
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
9
|
+
for (let key of __getOwnPropNames(from))
|
|
10
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
11
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
+
}
|
|
13
|
+
return to;
|
|
14
|
+
};
|
|
15
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
16
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
17
|
+
mod
|
|
18
|
+
));
|
|
19
|
+
var import_enhanced_resolve = __toESM(require("enhanced-resolve"));
|
|
20
|
+
const resolver = import_enhanced_resolve.default.create.sync({
|
|
21
|
+
conditionNames: ["require", "node", "default"],
|
|
22
|
+
extensions: [".js", ".json", ".node", ".ts", ".tsx"]
|
|
8
23
|
});
|
|
9
|
-
const shouldResolveByEnhance = url => /^@[^/]+\/[^/]+\/.*/.test(url);
|
|
10
|
-
module.exports = function
|
|
24
|
+
const shouldResolveByEnhance = (url) => /^@[^/]+\/[^/]+\/.*/.test(url);
|
|
25
|
+
module.exports = function(request, options) {
|
|
11
26
|
if (shouldResolveByEnhance(request)) {
|
|
12
27
|
return resolver(options.basedir, request);
|
|
13
28
|
}
|
|
14
29
|
return options.defaultResolver(request, options);
|
|
15
|
-
};
|
|
30
|
+
};
|