@modern-js/plugin-testing 2.35.0 → 2.36.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. package/dist/cjs/base/config/index.js +41 -22
  2. package/dist/cjs/base/config/patches/assetsModule.js +34 -7
  3. package/dist/cjs/base/config/patches/filemock.js +21 -8
  4. package/dist/cjs/base/config/patches/index.js +28 -11
  5. package/dist/cjs/base/config/patches/transformer.js +36 -9
  6. package/dist/cjs/base/config/resolver.js +24 -6
  7. package/dist/cjs/base/config/testConfigOperator.js +32 -15
  8. package/dist/cjs/base/config/transformer/babelTransformer.js +34 -12
  9. package/dist/cjs/base/hook.js +32 -23
  10. package/dist/cjs/base/index.js +41 -34
  11. package/dist/cjs/base/runJest.js +48 -30
  12. package/dist/cjs/base/types/index.js +15 -3
  13. package/dist/cjs/base/utils.js +46 -28
  14. package/dist/cjs/cli/bff/app.js +33 -25
  15. package/dist/cjs/cli/bff/constant.js +24 -7
  16. package/dist/cjs/cli/bff/index.js +48 -29
  17. package/dist/cjs/cli/bff/mockAPI.js +40 -18
  18. package/dist/cjs/cli/bff/setup.js +36 -18
  19. package/dist/cjs/cli/bff/utils/index.js +38 -12
  20. package/dist/cjs/cli/index.js +56 -40
  21. package/dist/cjs/cli/test.js +40 -18
  22. package/dist/cjs/constant.js +24 -7
  23. package/dist/cjs/index.js +22 -6
  24. package/dist/cjs/runtime-testing/app.js +38 -17
  25. package/dist/cjs/runtime-testing/base.js +38 -11
  26. package/dist/cjs/runtime-testing/bff.js +38 -12
  27. package/dist/cjs/runtime-testing/customRender.js +36 -14
  28. package/dist/cjs/runtime-testing/index.js +22 -5
  29. package/dist/cjs/runtime-testing/reduck.js +55 -38
  30. package/dist/cjs/runtime-testing/resolvePlugins.js +21 -8
  31. package/dist/esm/base/config/index.js +6 -2
  32. package/dist/esm/base/config/patches/assetsModule.js +4 -1
  33. package/dist/esm/base/config/patches/filemock.js +4 -1
  34. package/dist/esm/base/config/patches/index.js +4 -1
  35. package/dist/esm/base/config/patches/transformer.js +4 -1
  36. package/dist/esm/base/config/resolver.js +31 -22
  37. package/dist/esm/base/config/testConfigOperator.js +3 -1
  38. package/dist/esm/base/config/transformer/babelTransformer.js +6 -3
  39. package/dist/esm/base/hook.js +8 -3
  40. package/dist/esm/base/index.js +13 -5
  41. package/dist/esm/base/runJest.js +8 -4
  42. package/dist/esm/base/types/index.js +0 -1
  43. package/dist/esm/base/utils.js +8 -3
  44. package/dist/esm/cli/bff/app.js +10 -5
  45. package/dist/esm/cli/bff/constant.js +4 -1
  46. package/dist/esm/cli/bff/index.js +17 -13
  47. package/dist/esm/cli/bff/mockAPI.js +4 -1
  48. package/dist/esm/cli/bff/setup.js +5 -5
  49. package/dist/esm/cli/bff/utils/index.js +4 -1
  50. package/dist/esm/cli/index.js +10 -4
  51. package/dist/esm/cli/test.js +7 -4
  52. package/dist/esm/constant.js +4 -1
  53. package/dist/esm/runtime-testing/app.js +4 -1
  54. package/dist/esm/runtime-testing/base.js +4 -1
  55. package/dist/esm/runtime-testing/bff.js +3 -1
  56. package/dist/esm/runtime-testing/customRender.js +4 -1
  57. package/dist/esm/runtime-testing/reduck.js +16 -10
  58. package/dist/esm/runtime-testing/resolvePlugins.js +4 -1
  59. package/dist/esm-node/base/config/index.js +6 -2
  60. package/dist/esm-node/base/config/patches/assetsModule.js +4 -1
  61. package/dist/esm-node/base/config/patches/filemock.js +4 -1
  62. package/dist/esm-node/base/config/patches/index.js +4 -1
  63. package/dist/esm-node/base/config/patches/transformer.js +4 -1
  64. package/dist/esm-node/base/config/resolver.js +29 -20
  65. package/dist/esm-node/base/config/testConfigOperator.js +3 -1
  66. package/dist/esm-node/base/config/transformer/babelTransformer.js +6 -3
  67. package/dist/esm-node/base/hook.js +8 -3
  68. package/dist/esm-node/base/index.js +13 -5
  69. package/dist/esm-node/base/runJest.js +7 -4
  70. package/dist/esm-node/base/types/index.js +0 -1
  71. package/dist/esm-node/base/utils.js +8 -3
  72. package/dist/esm-node/cli/bff/app.js +7 -2
  73. package/dist/esm-node/cli/bff/constant.js +4 -1
  74. package/dist/esm-node/cli/bff/index.js +8 -4
  75. package/dist/esm-node/cli/bff/mockAPI.js +4 -1
  76. package/dist/esm-node/cli/bff/setup.js +3 -3
  77. package/dist/esm-node/cli/bff/utils/index.js +4 -1
  78. package/dist/esm-node/cli/index.js +10 -4
  79. package/dist/esm-node/cli/test.js +7 -4
  80. package/dist/esm-node/constant.js +4 -1
  81. package/dist/esm-node/runtime-testing/app.js +4 -1
  82. package/dist/esm-node/runtime-testing/base.js +4 -1
  83. package/dist/esm-node/runtime-testing/bff.js +3 -1
  84. package/dist/esm-node/runtime-testing/customRender.js +4 -1
  85. package/dist/esm-node/runtime-testing/reduck.js +16 -10
  86. package/dist/esm-node/runtime-testing/resolvePlugins.js +5 -2
  87. package/package.json +13 -13
@@ -5,18 +5,18 @@ import { compiler } from "@modern-js/babel-compiler";
5
5
  import { runTest } from "../base";
6
6
  var test = function() {
7
7
  var _ref = _async_to_generator(function(api) {
8
- var _userConfig_tools, _userConfig, _userConfig_tools1, _userConfig1, userConfig, appContext, jest, runtimeExportsPath;
8
+ var _userConfig_tools, _userConfig_tools1, userConfig, appContext, jest, runtimeExportsPath;
9
9
  return _ts_generator(this, function(_state) {
10
10
  switch (_state.label) {
11
11
  case 0:
12
12
  userConfig = api.useResolvedConfigContext();
13
13
  appContext = api.useAppContext();
14
14
  userConfig.testing = userConfig.testing || {};
15
- jest = userConfig.testing.jest || ((_userConfig = userConfig) === null || _userConfig === void 0 ? void 0 : (_userConfig_tools = _userConfig.tools) === null || _userConfig_tools === void 0 ? void 0 : _userConfig_tools.jest);
15
+ jest = userConfig.testing.jest || (userConfig === null || userConfig === void 0 ? void 0 : (_userConfig_tools = userConfig.tools) === null || _userConfig_tools === void 0 ? void 0 : _userConfig_tools.jest);
16
16
  if (Array.isArray(jest)) {
17
17
  userConfig.testing.jest = jest[0];
18
18
  }
19
- userConfig.testing.jest = userConfig.testing.jest || ((_userConfig1 = userConfig) === null || _userConfig1 === void 0 ? void 0 : (_userConfig_tools1 = _userConfig1.tools) === null || _userConfig_tools1 === void 0 ? void 0 : _userConfig_tools1.jest);
19
+ userConfig.testing.jest = userConfig.testing.jest || (userConfig === null || userConfig === void 0 ? void 0 : (_userConfig_tools1 = userConfig.tools) === null || _userConfig_tools1 === void 0 ? void 0 : _userConfig_tools1.jest);
20
20
  runtimeExportsPath = path.join(appContext.internalDirectory, ".runtime-exports");
21
21
  return [
22
22
  4,
@@ -54,4 +54,7 @@ var test = function() {
54
54
  return _ref.apply(this, arguments);
55
55
  };
56
56
  }();
57
- export default test;
57
+ var test_default = test;
58
+ export {
59
+ test_default as default
60
+ };
@@ -1 +1,4 @@
1
- export var MODERNJS_CONFIG_KEY = "__modernjs_config__";
1
+ var MODERNJS_CONFIG_KEY = "__modernjs_config__";
2
+ export {
3
+ MODERNJS_CONFIG_KEY
4
+ };
@@ -43,4 +43,7 @@ var ModernRuntime = /* @__PURE__ */ function() {
43
43
  ]);
44
44
  return ModernRuntime2;
45
45
  }();
46
- export default new ModernRuntime(global[MODERNJS_CONFIG_KEY] || {});
46
+ var app_default = new ModernRuntime(global[MODERNJS_CONFIG_KEY] || {});
47
+ export {
48
+ app_default as default
49
+ };
@@ -1,2 +1,5 @@
1
- export { default as renderApp } from "./customRender";
1
+ import { default as default2 } from "./customRender";
2
2
  export * from "@testing-library/react";
3
+ export {
4
+ default2 as renderApp
5
+ };
@@ -16,4 +16,6 @@ function request() {
16
16
  fn.returnHttp = false;
17
17
  return res;
18
18
  }
19
- export { request as testBff };
19
+ export {
20
+ request as testBff
21
+ };
@@ -10,4 +10,7 @@ var customRender = function(ui, options) {
10
10
  wrapper: WrapModernProviders
11
11
  }, options));
12
12
  };
13
- export default customRender;
13
+ var customRender_default = customRender;
14
+ export {
15
+ customRender_default as default
16
+ };
@@ -5,34 +5,40 @@ import effectsPlugin from "@modern-js-reduck/plugin-effects";
5
5
  import autoActionsPlugin from "@modern-js-reduck/plugin-auto-actions";
6
6
  import immerPlugin from "@modern-js-reduck/plugin-immutable";
7
7
  import { MODERNJS_CONFIG_KEY } from "../constant";
8
- export var effects = function() {
8
+ var effects = function() {
9
9
  return effectsPlugin;
10
10
  };
11
- export var immer = function() {
11
+ var immer = function() {
12
12
  return immerPlugin;
13
13
  };
14
- export var autoActions = function() {
14
+ var autoActions = function() {
15
15
  return autoActionsPlugin;
16
16
  };
17
- export var createStore = function(props) {
17
+ var createStore = function(props) {
18
18
  var createStatePlugins = function() {
19
- var _modernConfig_runtime, _modernConfig, _stateConfig, _stateConfig1, _stateConfig2, _props;
19
+ var _modernConfig_runtime;
20
20
  var modernConfig = global[MODERNJS_CONFIG_KEY];
21
- var stateConfig = (_modernConfig = modernConfig) === null || _modernConfig === void 0 ? void 0 : (_modernConfig_runtime = _modernConfig.runtime) === null || _modernConfig_runtime === void 0 ? void 0 : _modernConfig_runtime.state;
21
+ var stateConfig = modernConfig === null || modernConfig === void 0 ? void 0 : (_modernConfig_runtime = modernConfig.runtime) === null || _modernConfig_runtime === void 0 ? void 0 : _modernConfig_runtime.state;
22
22
  var plugins = [];
23
- if (((_stateConfig = stateConfig) === null || _stateConfig === void 0 ? void 0 : _stateConfig.effects) !== false) {
23
+ if ((stateConfig === null || stateConfig === void 0 ? void 0 : stateConfig.effects) !== false) {
24
24
  plugins.push(effects());
25
25
  }
26
- if (((_stateConfig1 = stateConfig) === null || _stateConfig1 === void 0 ? void 0 : _stateConfig1.autoActions) !== false) {
26
+ if ((stateConfig === null || stateConfig === void 0 ? void 0 : stateConfig.autoActions) !== false) {
27
27
  plugins.push(autoActions());
28
28
  }
29
- if (((_stateConfig2 = stateConfig) === null || _stateConfig2 === void 0 ? void 0 : _stateConfig2.immer) !== false) {
29
+ if ((stateConfig === null || stateConfig === void 0 ? void 0 : stateConfig.immer) !== false) {
30
30
  plugins.push(immer());
31
31
  }
32
- return (((_props = props) === null || _props === void 0 ? void 0 : _props.plugins) || []).concat(plugins);
32
+ return ((props === null || props === void 0 ? void 0 : props.plugins) || []).concat(plugins);
33
33
  };
34
34
  var config = _object_spread_props(_object_spread({}, props || {}), {
35
35
  plugins: createStatePlugins()
36
36
  });
37
37
  return originCreateStore(config);
38
38
  };
39
+ export {
40
+ autoActions,
41
+ createStore,
42
+ effects,
43
+ immer
44
+ };
@@ -3,7 +3,7 @@ var allowedFeatures = [
3
3
  "router",
4
4
  "state"
5
5
  ];
6
- export default function resolvePlugins(features) {
6
+ function resolvePlugins(features) {
7
7
  var plugins = [];
8
8
  if (!features) {
9
9
  return plugins;
@@ -16,3 +16,6 @@ export default function resolvePlugins(features) {
16
16
  });
17
17
  return plugins;
18
18
  }
19
+ export {
20
+ resolvePlugins as default
21
+ };
@@ -8,5 +8,9 @@ const patchConfig = async (testOperator) => {
8
8
  await applyPatches(testOperator);
9
9
  return testOperator.jestConfig;
10
10
  };
11
- export const DEFAULT_RESOLVER_PATH = require.resolve("./resolver");
12
- export { getJestUtils, patchConfig };
11
+ const DEFAULT_RESOLVER_PATH = require.resolve("./resolver");
12
+ export {
13
+ DEFAULT_RESOLVER_PATH,
14
+ getJestUtils,
15
+ patchConfig
16
+ };
@@ -1,4 +1,4 @@
1
- export const patchAssetsModule = (testOperator) => {
1
+ const patchAssetsModule = (testOperator) => {
2
2
  testOperator.mergeJestConfig({
3
3
  moduleNameMapper: {
4
4
  "\\.(css|less|scss|sass)$": require.resolve("identity-obj-proxy"),
@@ -6,3 +6,6 @@ export const patchAssetsModule = (testOperator) => {
6
6
  }
7
7
  });
8
8
  };
9
+ export {
10
+ patchAssetsModule
11
+ };
@@ -1 +1,4 @@
1
- export default "test-file-stub";
1
+ var filemock_default = "test-file-stub";
2
+ export {
3
+ filemock_default as default
4
+ };
@@ -9,6 +9,9 @@ const patches = [
9
9
  patchTransformer,
10
10
  patchAssetsModule
11
11
  ];
12
- export const applyPatches = async (testConfig) => {
12
+ const applyPatches = async (testConfig) => {
13
13
  await _applyPatches(patches, testConfig);
14
14
  };
15
+ export {
16
+ applyPatches
17
+ };
@@ -8,7 +8,7 @@ const resolveTsCompilerOptions = () => {
8
8
  tsCompilerOptions.jsx = "react-jsx";
9
9
  return tsCompilerOptions;
10
10
  };
11
- export const patchTransformer = (testOperator) => {
11
+ const patchTransformer = (testOperator) => {
12
12
  const { transformer } = testOperator.testConfig;
13
13
  if (transformer === "babel-jest") {
14
14
  testOperator.mergeJestConfig({
@@ -29,3 +29,6 @@ export const patchTransformer = (testOperator) => {
29
29
  });
30
30
  }
31
31
  };
32
+ export {
33
+ patchTransformer
34
+ };
@@ -1,22 +1,31 @@
1
+ var __getOwnPropNames = Object.getOwnPropertyNames;
2
+ var __commonJS = (cb, mod) => function __require() {
3
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
4
+ };
1
5
  import enhanceResolve from "enhanced-resolve";
2
- const resolver = enhanceResolve.create.sync({
3
- conditionNames: [
4
- "require",
5
- "node",
6
- "default"
7
- ],
8
- extensions: [
9
- ".js",
10
- ".json",
11
- ".node",
12
- ".ts",
13
- ".tsx"
14
- ]
15
- });
16
- const shouldResolveByEnhance = (url) => /^@[^/]+\/[^/]+\/.*/.test(url);
17
- module.exports = function(request, options) {
18
- if (shouldResolveByEnhance(request)) {
19
- return resolver(options.basedir, request);
6
+ var require_resolver = __commonJS({
7
+ "src/base/config/resolver.ts"(exports, module) {
8
+ const resolver = enhanceResolve.create.sync({
9
+ conditionNames: [
10
+ "require",
11
+ "node",
12
+ "default"
13
+ ],
14
+ extensions: [
15
+ ".js",
16
+ ".json",
17
+ ".node",
18
+ ".ts",
19
+ ".tsx"
20
+ ]
21
+ });
22
+ const shouldResolveByEnhance = (url) => /^@[^/]+\/[^/]+\/.*/.test(url);
23
+ module.exports = function(request, options) {
24
+ if (shouldResolveByEnhance(request)) {
25
+ return resolver(options.basedir, request);
26
+ }
27
+ return options.defaultResolver(request, options);
28
+ };
20
29
  }
21
- return options.defaultResolver(request, options);
22
- };
30
+ });
31
+ export default require_resolver();
@@ -55,4 +55,6 @@ class TestConfigOperator {
55
55
  this.initial();
56
56
  }
57
57
  }
58
- export { TestConfigOperator };
58
+ export {
59
+ TestConfigOperator
60
+ };
@@ -1,6 +1,6 @@
1
- var _babelJest_createTransformer, _babelJest;
1
+ var _babelJest_createTransformer;
2
2
  import babelJest from "babel-jest";
3
- const babelTransformer = (_babelJest_createTransformer = (_babelJest = babelJest).createTransformer) === null || _babelJest_createTransformer === void 0 ? void 0 : _babelJest_createTransformer.call(_babelJest, {
3
+ const babelTransformer = (_babelJest_createTransformer = babelJest.createTransformer) === null || _babelJest_createTransformer === void 0 ? void 0 : _babelJest_createTransformer.call(babelJest, {
4
4
  presets: [
5
5
  [
6
6
  require.resolve("@modern-js/babel-preset-app"),
@@ -13,4 +13,7 @@ const babelTransformer = (_babelJest_createTransformer = (_babelJest = babelJest
13
13
  configFile: false,
14
14
  babelrc: false
15
15
  });
16
- export default babelTransformer;
16
+ var babelTransformer_default = babelTransformer;
17
+ export {
18
+ babelTransformer_default as default
19
+ };
@@ -1,7 +1,12 @@
1
1
  import { createAsyncPipeline, createParallelWorkflow } from "@modern-js/plugin";
2
- export const jestConfigHook = createAsyncPipeline();
3
- export const afterTestHook = createParallelWorkflow();
4
- export const testingHooks = {
2
+ const jestConfigHook = createAsyncPipeline();
3
+ const afterTestHook = createParallelWorkflow();
4
+ const testingHooks = {
5
5
  jestConfig: createAsyncPipeline(),
6
6
  afterTest: createParallelWorkflow()
7
7
  };
8
+ export {
9
+ afterTestHook,
10
+ jestConfigHook,
11
+ testingHooks
12
+ };
@@ -1,6 +1,14 @@
1
- export { runTest, runJest } from "./runJest";
2
- export { getModuleNameMapper } from "./utils";
3
- export { DEFAULT_RESOLVER_PATH } from "./config";
4
- export { TestConfigOperator } from "./config/testConfigOperator";
5
- export { testingHooks } from "./hook";
1
+ import { runTest, runJest } from "./runJest";
2
+ import { getModuleNameMapper } from "./utils";
3
+ import { DEFAULT_RESOLVER_PATH } from "./config";
4
+ import { TestConfigOperator } from "./config/testConfigOperator";
5
+ import { testingHooks } from "./hook";
6
6
  export * from "./types";
7
+ export {
8
+ DEFAULT_RESOLVER_PATH,
9
+ TestConfigOperator,
10
+ getModuleNameMapper,
11
+ runJest,
12
+ runTest,
13
+ testingHooks
14
+ };
@@ -38,7 +38,7 @@ const readResultsAndExit = (result, globalConfig) => {
38
38
  }, 1e3).unref();
39
39
  }
40
40
  };
41
- export async function runJest(config, pwd = process.cwd()) {
41
+ async function runJest(config, pwd = process.cwd()) {
42
42
  try {
43
43
  const argvConfig = await buildArgv(process.argv.slice(2), config);
44
44
  const { results, globalConfig } = await runCLI(argvConfig, [
@@ -46,12 +46,11 @@ export async function runJest(config, pwd = process.cwd()) {
46
46
  ]);
47
47
  readResultsAndExit(results, globalConfig);
48
48
  } catch (e) {
49
- var _e;
50
- console.error(chalk.red(((_e = e) === null || _e === void 0 ? void 0 : _e.stack) || e));
49
+ console.error(chalk.red((e === null || e === void 0 ? void 0 : e.stack) || e));
51
50
  process.exit(1);
52
51
  }
53
52
  }
54
- export async function runTest(api, config, pwd = process.cwd()) {
53
+ async function runTest(api, config, pwd = process.cwd()) {
55
54
  process.env.NODE_ENV = "test";
56
55
  const jestUtils = getJestUtils(config);
57
56
  await patchConfig(jestUtils);
@@ -65,3 +64,7 @@ export async function runTest(api, config, pwd = process.cwd()) {
65
64
  await runJest(finalConfig, pwd);
66
65
  await hookRunners.afterTest();
67
66
  }
67
+ export {
68
+ runJest,
69
+ runTest
70
+ };
@@ -1 +0,0 @@
1
- export {};
@@ -1,8 +1,8 @@
1
1
  import fs from "fs";
2
2
  import path from "path";
3
3
  import { createDebugger } from "@modern-js/utils";
4
- export const debug = createDebugger("test");
5
- export const readCompilerOptions = (pwd = process.cwd(), filename = "tsconfig.json") => {
4
+ const debug = createDebugger("test");
5
+ const readCompilerOptions = (pwd = process.cwd(), filename = "tsconfig.json") => {
6
6
  let tsConfig = {};
7
7
  let extendedCompilerOptions = {};
8
8
  let tsconfigFile = "";
@@ -25,7 +25,7 @@ export const readCompilerOptions = (pwd = process.cwd(), filename = "tsconfig.js
25
25
  ...tsConfig.compilerOptions
26
26
  };
27
27
  };
28
- export const getModuleNameMapper = (alias) => Object.keys(alias).reduce((memo, cur) => {
28
+ const getModuleNameMapper = (alias) => Object.keys(alias).reduce((memo, cur) => {
29
29
  const aliasValue = Array.isArray(alias[cur]) ? alias[cur] : [
30
30
  alias[cur]
31
31
  ];
@@ -42,3 +42,8 @@ export const getModuleNameMapper = (alias) => Object.keys(alias).reduce((memo, c
42
42
  memo[key] = value;
43
43
  return memo;
44
44
  }, {});
45
+ export {
46
+ debug,
47
+ getModuleNameMapper,
48
+ readCompilerOptions
49
+ };
@@ -1,7 +1,7 @@
1
1
  import { AsyncLocalStorage } from "async_hooks";
2
2
  import { Server } from "@modern-js/prod-server";
3
3
  const store = new AsyncLocalStorage();
4
- export const isInHandler = () => Boolean(store.getStore());
4
+ const isInHandler = () => Boolean(store.getStore());
5
5
  let server = null;
6
6
  const createApp = async (pwd, config, plugins, routes) => {
7
7
  if (!server) {
@@ -30,4 +30,9 @@ const closeServer = async () => {
30
30
  }
31
31
  await server.close();
32
32
  };
33
- export { createApp, getApp, closeServer };
33
+ export {
34
+ closeServer,
35
+ createApp,
36
+ getApp,
37
+ isInHandler
38
+ };
@@ -1 +1,4 @@
1
- export const bff_info_key = "modern_bff_info";
1
+ const bff_info_key = "modern_bff_info";
2
+ export {
3
+ bff_info_key
4
+ };
@@ -3,8 +3,8 @@ import { isApiOnly } from "@modern-js/utils";
3
3
  import { getModuleNameMapper, DEFAULT_RESOLVER_PATH } from "../../base";
4
4
  import { bff_info_key } from "./constant";
5
5
  import { isBFFProject } from "./utils";
6
- export const setJestConfigForBFF = async ({ pwd, userConfig, plugins, routes, utils }) => {
7
- var _userConfig_source, _userConfig;
6
+ const setJestConfigForBFF = async ({ pwd, userConfig, plugins, routes, utils }) => {
7
+ var _userConfig_source;
8
8
  const bffConfig = {
9
9
  rootDir: path.join(pwd, "./api"),
10
10
  setupFilesAfterEnv: [
@@ -27,7 +27,7 @@ export const setJestConfigForBFF = async ({ pwd, userConfig, plugins, routes, ut
27
27
  }
28
28
  };
29
29
  const { jestConfig } = utils;
30
- const alias = ((_userConfig = userConfig) === null || _userConfig === void 0 ? void 0 : (_userConfig_source = _userConfig.source) === null || _userConfig_source === void 0 ? void 0 : _userConfig_source.alias) || {};
30
+ const alias = (userConfig === null || userConfig === void 0 ? void 0 : (_userConfig_source = userConfig.source) === null || _userConfig_source === void 0 ? void 0 : _userConfig_source.alias) || {};
31
31
  const aliasMapper = getModuleNameMapper(alias);
32
32
  const { moduleNameMapper } = jestConfig;
33
33
  const transform = {
@@ -89,7 +89,7 @@ export const setJestConfigForBFF = async ({ pwd, userConfig, plugins, routes, ut
89
89
  }
90
90
  utils.setJestConfig(commonConfig);
91
91
  };
92
- export const testingBffPlugin = () => ({
92
+ const testingBffPlugin = () => ({
93
93
  name: "@modern-js/testing-plugin-bff",
94
94
  setup(api) {
95
95
  return {
@@ -112,3 +112,7 @@ export const testingBffPlugin = () => ({
112
112
  };
113
113
  }
114
114
  });
115
+ export {
116
+ setJestConfigForBFF,
117
+ testingBffPlugin
118
+ };
@@ -45,7 +45,7 @@ const mock_getParamsAndPayload = (args) => {
45
45
  }
46
46
  }
47
47
  };
48
- export default (mockApiInfosByFile) => {
48
+ var mockAPI_default = (mockApiInfosByFile) => {
49
49
  const files = Object.keys(mockApiInfosByFile);
50
50
  files.forEach((mockedFile) => {
51
51
  jest.mock(mockedFile, () => {
@@ -100,3 +100,6 @@ export default (mockApiInfosByFile) => {
100
100
  });
101
101
  });
102
102
  };
103
+ export {
104
+ mockAPI_default as default
105
+ };
@@ -5,14 +5,14 @@ import mockAPI from "./mockAPI";
5
5
  import { createApp, closeServer } from "./app";
6
6
  let uped = false;
7
7
  const setup = () => {
8
- var _bff_info_modernUserConfig_bff, _bff_info_modernUserConfig, _bff_info, _bff_info_modernUserConfig_bff1, _bff_info_modernUserConfig1, _bff_info1;
8
+ var _bff_info_modernUserConfig_bff, _bff_info_modernUserConfig, _bff_info_modernUserConfig_bff1, _bff_info_modernUserConfig1;
9
9
  if (uped) {
10
10
  return;
11
11
  }
12
12
  uped = true;
13
13
  const bff_info = global[bff_info_key];
14
- const prefix = (_bff_info = bff_info) === null || _bff_info === void 0 ? void 0 : (_bff_info_modernUserConfig = _bff_info.modernUserConfig) === null || _bff_info_modernUserConfig === void 0 ? void 0 : (_bff_info_modernUserConfig_bff = _bff_info_modernUserConfig.bff) === null || _bff_info_modernUserConfig_bff === void 0 ? void 0 : _bff_info_modernUserConfig_bff.prefix;
15
- const httpMethodDecider = (_bff_info1 = bff_info) === null || _bff_info1 === void 0 ? void 0 : (_bff_info_modernUserConfig1 = _bff_info1.modernUserConfig) === null || _bff_info_modernUserConfig1 === void 0 ? void 0 : (_bff_info_modernUserConfig_bff1 = _bff_info_modernUserConfig1.bff) === null || _bff_info_modernUserConfig_bff1 === void 0 ? void 0 : _bff_info_modernUserConfig_bff1.httpMethodDecider;
14
+ const prefix = bff_info === null || bff_info === void 0 ? void 0 : (_bff_info_modernUserConfig = bff_info.modernUserConfig) === null || _bff_info_modernUserConfig === void 0 ? void 0 : (_bff_info_modernUserConfig_bff = _bff_info_modernUserConfig.bff) === null || _bff_info_modernUserConfig_bff === void 0 ? void 0 : _bff_info_modernUserConfig_bff.prefix;
15
+ const httpMethodDecider = bff_info === null || bff_info === void 0 ? void 0 : (_bff_info_modernUserConfig1 = bff_info.modernUserConfig) === null || _bff_info_modernUserConfig1 === void 0 ? void 0 : (_bff_info_modernUserConfig_bff1 = _bff_info_modernUserConfig1.bff) === null || _bff_info_modernUserConfig_bff1 === void 0 ? void 0 : _bff_info_modernUserConfig_bff1.httpMethodDecider;
16
16
  let app = null;
17
17
  beforeAll(async () => {
18
18
  const apiRouter = new ApiRouter({
@@ -1,6 +1,6 @@
1
1
  import path from "path";
2
2
  import { chalk } from "@modern-js/utils";
3
- export const isBFFProject = (pwd) => {
3
+ const isBFFProject = (pwd) => {
4
4
  try {
5
5
  const packageJson = require(path.join(pwd, "./package.json"));
6
6
  const { dependencies, devDependencies } = packageJson;
@@ -15,3 +15,6 @@ export const isBFFProject = (pwd) => {
15
15
  return false;
16
16
  }
17
17
  };
18
+ export {
19
+ isBFFProject
20
+ };
@@ -4,13 +4,13 @@ import { testingHooks, getModuleNameMapper, DEFAULT_RESOLVER_PATH } from "../bas
4
4
  import { MODERNJS_CONFIG_KEY } from "../constant";
5
5
  import { testingBffPlugin } from "./bff";
6
6
  import test from "./test";
7
- export const mergeUserJestConfig = (testUtils) => {
7
+ const mergeUserJestConfig = (testUtils) => {
8
8
  const resolveJestConfig = testUtils.testConfig.jest;
9
9
  if (resolveJestConfig && typeof resolveJestConfig !== "function") {
10
10
  testUtils.mergeJestConfig(resolveJestConfig);
11
11
  }
12
12
  };
13
- export const getJestTransformEsModulesRegStr = () => {
13
+ const getJestTransformEsModulesRegStr = () => {
14
14
  const esmModulesInPnpm = [
15
15
  "@modern-js\\+runtime@",
16
16
  "@modern-js\\+plugin@",
@@ -26,7 +26,7 @@ export const getJestTransformEsModulesRegStr = () => {
26
26
  ];
27
27
  return `node_modules/(?!(\\.pnpm/(${esmModulesInPnpm.join("|")}))|(${esmModules.join("|")}))`;
28
28
  };
29
- export const testingPlugin = () => {
29
+ const testingPlugin = () => {
30
30
  const bffPlugin = testingBffPlugin();
31
31
  return {
32
32
  name: "@modern-js/plugin-testing",
@@ -136,4 +136,10 @@ export const testingPlugin = () => {
136
136
  }
137
137
  };
138
138
  };
139
- export default testingPlugin;
139
+ var cli_default = testingPlugin;
140
+ export {
141
+ cli_default as default,
142
+ getJestTransformEsModulesRegStr,
143
+ mergeUserJestConfig,
144
+ testingPlugin
145
+ };
@@ -2,15 +2,15 @@ import path from "path";
2
2
  import { compiler } from "@modern-js/babel-compiler";
3
3
  import { runTest } from "../base";
4
4
  const test = async (api) => {
5
- var _userConfig_tools, _userConfig, _userConfig_tools1, _userConfig1;
5
+ var _userConfig_tools, _userConfig_tools1;
6
6
  const userConfig = api.useResolvedConfigContext();
7
7
  const appContext = api.useAppContext();
8
8
  userConfig.testing = userConfig.testing || {};
9
- const jest = userConfig.testing.jest || ((_userConfig = userConfig) === null || _userConfig === void 0 ? void 0 : (_userConfig_tools = _userConfig.tools) === null || _userConfig_tools === void 0 ? void 0 : _userConfig_tools.jest);
9
+ const jest = userConfig.testing.jest || (userConfig === null || userConfig === void 0 ? void 0 : (_userConfig_tools = userConfig.tools) === null || _userConfig_tools === void 0 ? void 0 : _userConfig_tools.jest);
10
10
  if (Array.isArray(jest)) {
11
11
  userConfig.testing.jest = jest[0];
12
12
  }
13
- userConfig.testing.jest = userConfig.testing.jest || ((_userConfig1 = userConfig) === null || _userConfig1 === void 0 ? void 0 : (_userConfig_tools1 = _userConfig1.tools) === null || _userConfig_tools1 === void 0 ? void 0 : _userConfig_tools1.jest);
13
+ userConfig.testing.jest = userConfig.testing.jest || (userConfig === null || userConfig === void 0 ? void 0 : (_userConfig_tools1 = userConfig.tools) === null || _userConfig_tools1 === void 0 ? void 0 : _userConfig_tools1.jest);
14
14
  const runtimeExportsPath = path.join(appContext.internalDirectory, ".runtime-exports");
15
15
  await compiler({
16
16
  sourceDir: runtimeExportsPath,
@@ -29,4 +29,7 @@ const test = async (api) => {
29
29
  });
30
30
  await runTest(api, userConfig.testing);
31
31
  };
32
- export default test;
32
+ var test_default = test;
33
+ export {
34
+ test_default as default
35
+ };
@@ -1 +1,4 @@
1
- export const MODERNJS_CONFIG_KEY = "__modernjs_config__";
1
+ const MODERNJS_CONFIG_KEY = "__modernjs_config__";
2
+ export {
3
+ MODERNJS_CONFIG_KEY
4
+ };
@@ -32,4 +32,7 @@ class ModernRuntime {
32
32
  this.options = options;
33
33
  }
34
34
  }
35
- export default new ModernRuntime(global[MODERNJS_CONFIG_KEY] || {});
35
+ var app_default = new ModernRuntime(global[MODERNJS_CONFIG_KEY] || {});
36
+ export {
37
+ app_default as default
38
+ };
@@ -1,2 +1,5 @@
1
- export { default as renderApp } from "./customRender";
1
+ import { default as default2 } from "./customRender";
2
2
  export * from "@testing-library/react";
3
+ export {
4
+ default2 as renderApp
5
+ };
@@ -11,4 +11,6 @@ function request(...args) {
11
11
  fn.returnHttp = false;
12
12
  return res;
13
13
  }
14
- export { request as testBff };
14
+ export {
15
+ request as testBff
16
+ };
@@ -6,4 +6,7 @@ const customRender = (ui, options) => render(ui, {
6
6
  wrapper: WrapModernProviders,
7
7
  ...options
8
8
  });
9
- export default customRender;
9
+ var customRender_default = customRender;
10
+ export {
11
+ customRender_default as default
12
+ };