@modern-js/plugin-testing 2.20.1-alpha.0 → 2.21.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/package.json +17 -17
  3. package/dist/js/modern/base/config/index.js +0 -36
  4. package/dist/js/modern/base/config/patches/assetsModule.js +0 -11
  5. package/dist/js/modern/base/config/patches/filemock.js +0 -4
  6. package/dist/js/modern/base/config/patches/index.js +0 -34
  7. package/dist/js/modern/base/config/patches/transformer.js +0 -38
  8. package/dist/js/modern/base/config/resolver.js +0 -21
  9. package/dist/js/modern/base/config/testConfigOperator.js +0 -69
  10. package/dist/js/modern/base/config/transformer/babelTransformer.js +0 -19
  11. package/dist/js/modern/base/hook.js +0 -12
  12. package/dist/js/modern/base/index.js +0 -14
  13. package/dist/js/modern/base/runJest.js +0 -102
  14. package/dist/js/modern/base/types/index.js +0 -0
  15. package/dist/js/modern/base/utils.js +0 -66
  16. package/dist/js/modern/cli/bff/app.js +0 -58
  17. package/dist/js/modern/cli/bff/constant.js +0 -4
  18. package/dist/js/modern/cli/bff/index.js +0 -149
  19. package/dist/js/modern/cli/bff/mockAPI.js +0 -109
  20. package/dist/js/modern/cli/bff/setup.js +0 -75
  21. package/dist/js/modern/cli/bff/utils/index.js +0 -37
  22. package/dist/js/modern/cli/index.js +0 -115
  23. package/dist/js/modern/cli/test.js +0 -61
  24. package/dist/js/modern/constant.js +0 -4
  25. package/dist/js/modern/index.js +0 -3
  26. package/dist/js/modern/runtime-testing/app.js +0 -48
  27. package/dist/js/modern/runtime-testing/base.js +0 -7
  28. package/dist/js/modern/runtime-testing/customRender.js +0 -25
  29. package/dist/js/modern/runtime-testing/index.js +0 -2
  30. package/dist/js/modern/runtime-testing/reduck.js +0 -55
  31. package/dist/js/modern/runtime-testing/request.js +0 -16
  32. package/dist/js/modern/runtime-testing/resolvePlugins.js +0 -33
  33. package/dist/js/node/base/config/index.js +0 -67
  34. package/dist/js/node/base/config/patches/assetsModule.js +0 -40
  35. package/dist/js/node/base/config/patches/filemock.js +0 -25
  36. package/dist/js/node/base/config/patches/index.js +0 -57
  37. package/dist/js/node/base/config/patches/transformer.js +0 -67
  38. package/dist/js/node/base/config/resolver.js +0 -30
  39. package/dist/js/node/base/config/testConfigOperator.js +0 -90
  40. package/dist/js/node/base/config/transformer/babelTransformer.js +0 -46
  41. package/dist/js/node/base/hook.js +0 -37
  42. package/dist/js/node/base/index.js +0 -43
  43. package/dist/js/node/base/runJest.js +0 -132
  44. package/dist/js/node/base/types/index.js +0 -15
  45. package/dist/js/node/base/utils.js +0 -95
  46. package/dist/js/node/cli/bff/app.js +0 -84
  47. package/dist/js/node/cli/bff/constant.js +0 -27
  48. package/dist/js/node/cli/bff/index.js +0 -173
  49. package/dist/js/node/cli/bff/mockAPI.js +0 -134
  50. package/dist/js/node/cli/bff/setup.js +0 -84
  51. package/dist/js/node/cli/bff/utils/index.js +0 -64
  52. package/dist/js/node/cli/index.js +0 -135
  53. package/dist/js/node/cli/test.js +0 -88
  54. package/dist/js/node/constant.js +0 -27
  55. package/dist/js/node/index.js +0 -19
  56. package/dist/js/node/runtime-testing/app.js +0 -73
  57. package/dist/js/node/runtime-testing/base.js +0 -38
  58. package/dist/js/node/runtime-testing/customRender.js +0 -50
  59. package/dist/js/node/runtime-testing/index.js +0 -18
  60. package/dist/js/node/runtime-testing/reduck.js +0 -85
  61. package/dist/js/node/runtime-testing/request.js +0 -45
  62. package/dist/js/node/runtime-testing/resolvePlugins.js +0 -52
  63. package/dist/js/treeshaking/base/config/index.js +0 -154
  64. package/dist/js/treeshaking/base/config/patches/assetsModule.js +0 -9
  65. package/dist/js/treeshaking/base/config/patches/filemock.js +0 -2
  66. package/dist/js/treeshaking/base/config/patches/index.js +0 -225
  67. package/dist/js/treeshaking/base/config/patches/transformer.js +0 -36
  68. package/dist/js/treeshaking/base/config/resolver.js +0 -37
  69. package/dist/js/treeshaking/base/config/testConfigOperator.js +0 -127
  70. package/dist/js/treeshaking/base/config/transformer/babelTransformer.js +0 -17
  71. package/dist/js/treeshaking/base/hook.js +0 -8
  72. package/dist/js/treeshaking/base/index.js +0 -7
  73. package/dist/js/treeshaking/base/runJest.js +0 -292
  74. package/dist/js/treeshaking/base/types/index.js +0 -1
  75. package/dist/js/treeshaking/base/utils.js +0 -76
  76. package/dist/js/treeshaking/cli/bff/app.js +0 -200
  77. package/dist/js/treeshaking/cli/bff/constant.js +0 -2
  78. package/dist/js/treeshaking/cli/bff/index.js +0 -297
  79. package/dist/js/treeshaking/cli/bff/mockAPI.js +0 -188
  80. package/dist/js/treeshaking/cli/bff/setup.js +0 -192
  81. package/dist/js/treeshaking/cli/bff/utils/index.js +0 -47
  82. package/dist/js/treeshaking/cli/index.js +0 -255
  83. package/dist/js/treeshaking/cli/test.js +0 -180
  84. package/dist/js/treeshaking/constant.js +0 -2
  85. package/dist/js/treeshaking/index.js +0 -3
  86. package/dist/js/treeshaking/runtime-testing/app.js +0 -90
  87. package/dist/js/treeshaking/runtime-testing/base.js +0 -4
  88. package/dist/js/treeshaking/runtime-testing/customRender.js +0 -41
  89. package/dist/js/treeshaking/runtime-testing/index.js +0 -2
  90. package/dist/js/treeshaking/runtime-testing/reduck.js +0 -89
  91. package/dist/js/treeshaking/runtime-testing/request.js +0 -51
  92. package/dist/js/treeshaking/runtime-testing/resolvePlugins.js +0 -46
@@ -1,55 +0,0 @@
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";
24
- import { MODERNJS_CONFIG_KEY } from "../constant";
25
- const effects = () => effectsPlugin;
26
- const immer = () => immerPlugin;
27
- const autoActions = () => autoActionsPlugin;
28
- const createStore = (props) => {
29
- const createStatePlugins = () => {
30
- var _a;
31
- const modernConfig = global[MODERNJS_CONFIG_KEY];
32
- const stateConfig = (_a = modernConfig == null ? void 0 : modernConfig.runtime) == null ? void 0 : _a.state;
33
- const plugins = [];
34
- if ((stateConfig == null ? void 0 : stateConfig.effects) !== false) {
35
- plugins.push(effects());
36
- }
37
- if ((stateConfig == null ? void 0 : stateConfig.autoActions) !== false) {
38
- plugins.push(autoActions());
39
- }
40
- if ((stateConfig == null ? void 0 : stateConfig.immer) !== false) {
41
- plugins.push(immer());
42
- }
43
- return ((props == null ? void 0 : props.plugins) || []).concat(plugins);
44
- };
45
- const config = __spreadProps(__spreadValues({}, props || {}), {
46
- plugins: createStatePlugins()
47
- });
48
- return originCreateStore(config);
49
- };
50
- export {
51
- autoActions,
52
- createStore,
53
- effects,
54
- immer
55
- };
@@ -1,16 +0,0 @@
1
- import supertest from "supertest";
2
- import { getApp } from "../cli/bff/app";
3
- function request(...args) {
4
- const [fn, ...extraArgs] = args;
5
- const app = getApp();
6
- if (!fn) {
7
- return supertest(app);
8
- }
9
- fn.returnHttp = true;
10
- const res = fn(...extraArgs);
11
- fn.returnHttp = false;
12
- return res;
13
- }
14
- export {
15
- request
16
- };
@@ -1,33 +0,0 @@
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) {
19
- const plugins = [];
20
- if (!features) {
21
- return plugins;
22
- }
23
- Object.keys(features).forEach((feature) => {
24
- if (allowedFeatures.includes(feature)) {
25
- const curPluginRes = require(`@modern-js/runtime/plugins`)[feature](__spreadValues({}, features[feature]));
26
- plugins.push(curPluginRes);
27
- }
28
- });
29
- return plugins;
30
- }
31
- export {
32
- resolvePlugins as default
33
- };
@@ -1,67 +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 __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
49
- });
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);
55
- return testOperator;
56
- };
57
- const patchConfig = (testOperator) => __async(void 0, null, function* () {
58
- yield (0, import_patches.applyPatches)(testOperator);
59
- return testOperator.jestConfig;
60
- });
61
- const DEFAULT_RESOLVER_PATH = require.resolve("./resolver");
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,40 +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 assetsModule_exports = {};
25
- __export(assetsModule_exports, {
26
- patchAssetsModule: () => patchAssetsModule
27
- });
28
- module.exports = __toCommonJS(assetsModule_exports);
29
- const patchAssetsModule = (testOperator) => {
30
- testOperator.mergeJestConfig({
31
- moduleNameMapper: {
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")
34
- }
35
- });
36
- };
37
- // Annotate the CommonJS export names for ESM import in node:
38
- 0 && (module.exports = {
39
- patchAssetsModule
40
- });
@@ -1,25 +0,0 @@
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
21
- });
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,57 +0,0 @@
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 __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
- });
37
- };
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,67 +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 transformer_exports = {};
25
- __export(transformer_exports, {
26
- patchTransformer: () => patchTransformer
27
- });
28
- module.exports = __toCommonJS(transformer_exports);
29
- var import_utils = require("../../utils");
30
- const resolveTsCompilerOptions = () => {
31
- const tsCompilerOptions = (0, import_utils.readCompilerOptions)() || {};
32
- const { jsx } = tsCompilerOptions;
33
- if (!jsx) {
34
- return null;
35
- }
36
- tsCompilerOptions.jsx = "react-jsx";
37
- return tsCompilerOptions;
38
- };
39
- const patchTransformer = (testOperator) => {
40
- const { transformer } = testOperator.testConfig;
41
- if (transformer === "babel-jest") {
42
- testOperator.mergeJestConfig({
43
- transform: {
44
- "\\.[jt]sx?$": require.resolve("../transformer/babelTransformer")
45
- }
46
- });
47
- }
48
- if (transformer === "ts-jest") {
49
- testOperator.mergeJestConfig({
50
- transform: {
51
- "\\.[jt]sx?$": require.resolve("ts-jest")
52
- }
53
- });
54
- const compilerOptions = resolveTsCompilerOptions();
55
- compilerOptions && testOperator.mergeJestConfig({
56
- globals: {
57
- "ts-jest": {
58
- tsconfig: compilerOptions
59
- }
60
- }
61
- });
62
- }
63
- };
64
- // Annotate the CommonJS export names for ESM import in node:
65
- 0 && (module.exports = {
66
- patchTransformer
67
- });
@@ -1,30 +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 __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"]
23
- });
24
- const shouldResolveByEnhance = (url) => /^@[^/]+\/[^/]+\/.*/.test(url);
25
- module.exports = function(request, options) {
26
- if (shouldResolveByEnhance(request)) {
27
- return resolver(options.basedir, request);
28
- }
29
- return options.defaultResolver(request, options);
30
- };
@@ -1,90 +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 testConfigOperator_exports = {};
33
- __export(testConfigOperator_exports, {
34
- TestConfigOperator: () => TestConfigOperator
35
- });
36
- module.exports = __toCommonJS(testConfigOperator_exports);
37
- var import_lodash = require("@modern-js/utils/lodash");
38
- class TestConfigOperator {
39
- constructor(testConfig) {
40
- this.defaultTestConfig = {
41
- transformer: "babel-jest"
42
- };
43
- this._testConfig = testConfig;
44
- this._jestConfig = {};
45
- this.userJestConfig = testConfig.jest;
46
- this.initial();
47
- }
48
- initial() {
49
- this._testConfig = (0, import_lodash.merge)({}, this.defaultTestConfig, this.testConfig);
50
- }
51
- get jestConfig() {
52
- return this._jestConfig;
53
- }
54
- get testConfig() {
55
- return this._testConfig;
56
- }
57
- mergeJestConfig(sourceConfig) {
58
- this._jestConfig = (0, import_lodash.merge)({}, this._jestConfig, sourceConfig);
59
- }
60
- setJestUserConfig() {
61
- const { userJestConfig } = this;
62
- if (typeof userJestConfig === "object") {
63
- this.setJestConfig(userJestConfig);
64
- }
65
- }
66
- setJestConfig(sourceConfig, options) {
67
- if (options) {
68
- const { force } = options;
69
- if (force) {
70
- this._jestConfig = sourceConfig;
71
- return;
72
- }
73
- }
74
- this._jestConfig = __spreadValues(__spreadValues({}, this._jestConfig), sourceConfig);
75
- }
76
- getFinalConfig() {
77
- const { userJestConfig } = this;
78
- if (!userJestConfig) {
79
- return this._jestConfig;
80
- }
81
- if (typeof userJestConfig === "function") {
82
- return userJestConfig(this._jestConfig);
83
- }
84
- return this.jestConfig;
85
- }
86
- }
87
- // Annotate the CommonJS export names for ESM import in node:
88
- 0 && (module.exports = {
89
- TestConfigOperator
90
- });
@@ -1,46 +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 babelTransformer_exports = {};
25
- __export(babelTransformer_exports, {
26
- default: () => babelTransformer_default
27
- });
28
- module.exports = __toCommonJS(babelTransformer_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
- ],
41
- configFile: false,
42
- babelrc: false
43
- });
44
- var babelTransformer_default = babelTransformer;
45
- // Annotate the CommonJS export names for ESM import in node:
46
- 0 && (module.exports = {});
@@ -1,37 +0,0 @@
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 hook_exports = {};
19
- __export(hook_exports, {
20
- afterTestHook: () => afterTestHook,
21
- jestConfigHook: () => jestConfigHook,
22
- testingHooks: () => testingHooks
23
- });
24
- module.exports = __toCommonJS(hook_exports);
25
- var import_plugin = require("@modern-js/plugin");
26
- const jestConfigHook = (0, import_plugin.createAsyncPipeline)();
27
- const afterTestHook = (0, import_plugin.createParallelWorkflow)();
28
- const testingHooks = {
29
- jestConfig: (0, import_plugin.createAsyncPipeline)(),
30
- afterTest: (0, import_plugin.createParallelWorkflow)()
31
- };
32
- // Annotate the CommonJS export names for ESM import in node:
33
- 0 && (module.exports = {
34
- afterTestHook,
35
- jestConfigHook,
36
- testingHooks
37
- });
@@ -1,43 +0,0 @@
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 __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 base_exports = {};
20
- __export(base_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
27
- });
28
- module.exports = __toCommonJS(base_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(base_exports, require("./types"), module.exports);
35
- // Annotate the CommonJS export names for ESM import in node:
36
- 0 && (module.exports = {
37
- DEFAULT_RESOLVER_PATH,
38
- TestConfigOperator,
39
- getModuleNameMapper,
40
- runJest,
41
- runTest,
42
- testingHooks
43
- });