@modern-js/plugin-testing 1.4.2 → 1.5.2

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/.eslintrc.js CHANGED
@@ -1,7 +1,9 @@
1
1
  module.exports = {
2
+ root: true,
2
3
  extends: ['@modern-js'],
3
4
  parserOptions: {
4
- project: require.resolve('./tsconfig.json'),
5
+ tsconfigRootDir: __dirname,
6
+ project: ['./tsconfig.json'],
5
7
  },
6
- ignorePatterns: ['type.d.ts'],
8
+ ignorePatterns: ['types'],
7
9
  };
package/CHANGELOG.md CHANGED
@@ -1,5 +1,63 @@
1
1
  # @modern-js/plugin-testing
2
2
 
3
+ ## 1.5.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 6c1438d2: fix: missing peer deps warnings
8
+ - 77519490: refactor(webpack): remove `@modern-js/core`
9
+ - 50f351b2: fix:
10
+
11
+ 1. plugin-testing types
12
+ 2. `tools.jest` not working when combined with bff testing
13
+
14
+ - Updated dependencies [2d155c4c]
15
+ - Updated dependencies [a0475f1a]
16
+ - Updated dependencies [123e432d]
17
+ - Updated dependencies [6c1438d2]
18
+ - Updated dependencies [e5a9b26d]
19
+ - Updated dependencies [0b26b93b]
20
+ - Updated dependencies [123e432d]
21
+ - Updated dependencies [f9f66ef9]
22
+ - Updated dependencies [71526621]
23
+ - Updated dependencies [77519490]
24
+ - Updated dependencies [592edabc]
25
+ - Updated dependencies [3578716a]
26
+ - Updated dependencies [895fa0ff]
27
+ - Updated dependencies [3d1fac2a]
28
+ - Updated dependencies [3578913e]
29
+ - Updated dependencies [50f351b2]
30
+ - Updated dependencies [1c3beab3]
31
+ - @modern-js/utils@1.6.0
32
+ - @modern-js/webpack@1.5.7
33
+ - @modern-js/testing@1.4.4
34
+ - @modern-js/bff-utils@1.2.4
35
+ - @modern-js/testing-plugin-bff@1.4.1
36
+ - @modern-js/runtime-core@1.4.3
37
+
38
+ ## 1.5.0
39
+
40
+ ### Minor Changes
41
+
42
+ - 3bf4f8b0: feat: support start api server only
43
+
44
+ ### Patch Changes
45
+
46
+ - 04ae5262: chore: bump @modern-js/utils to v1.4.1 in dependencies
47
+ - 60f7d8bf: feat: add tests dir to npmignore
48
+ - Updated dependencies [b8599d09]
49
+ - Updated dependencies [6cffe99d]
50
+ - Updated dependencies [04ae5262]
51
+ - Updated dependencies [60f7d8bf]
52
+ - Updated dependencies [e4cec1ce]
53
+ - Updated dependencies [3bf4f8b0]
54
+ - @modern-js/utils@1.5.0
55
+ - @modern-js/webpack@1.5.5
56
+ - @modern-js/testing@1.4.3
57
+ - @modern-js/testing-plugin-bff@1.4.0
58
+ - @modern-js/runtime-core@1.4.2
59
+ - @modern-js/babel-compiler@1.2.3
60
+
3
61
  ## 1.4.2
4
62
 
5
63
  ### Patch Changes
@@ -1,20 +1,16 @@
1
1
  import path from 'path';
2
- import { fs, PLUGIN_SCHEMAS, createRuntimeExportsUtils } from '@modern-js/utils';
3
- import { jestConfigHook, getModuleNameMapper, DEFAULT_RESOLVER_PATH } from '@modern-js/testing';
2
+ import { PLUGIN_SCHEMAS, createRuntimeExportsUtils, isApiOnly } from '@modern-js/utils';
3
+ import { testingHooks, getModuleNameMapper, DEFAULT_RESOLVER_PATH } from '@modern-js/testing';
4
4
  import { getWebpackConfig, WebpackConfigTarget } from '@modern-js/webpack';
5
5
  import TestingBffPlugin from '@modern-js/testing-plugin-bff';
6
6
  import { MODERNJS_CONFIG_KEY } from "../constant";
7
7
  import test from "./test";
8
8
  export const mergeUserJestConfig = testUtils => {
9
- const resolveJestConfig = testUtils.testConfig.jest;
9
+ const resolveJestConfig = testUtils.testConfig.jest; // resolveJestConfig 如果是函数类型,在所有测试插件 jestConfig 都执行后,再执行生成最终配置
10
10
 
11
11
  if (resolveJestConfig && typeof resolveJestConfig !== 'function') {
12
12
  testUtils.mergeJestConfig(resolveJestConfig);
13
13
  }
14
-
15
- if (typeof resolveJestConfig === 'function') {
16
- resolveJestConfig(testUtils.jestConfig);
17
- }
18
14
  };
19
15
  export default (() => {
20
16
  const BffPlugin = TestingBffPlugin();
@@ -22,18 +18,14 @@ export default (() => {
22
18
  name: '@modern-js/plugin-testing',
23
19
  usePlugins: [BffPlugin],
24
20
  post: [BffPlugin.name],
25
- registerHook: {
26
- jestConfig: jestConfigHook
27
- },
21
+ registerHook: testingHooks,
28
22
  setup: api => {
29
23
  let testingExportsUtils;
30
- const appContext = api.useAppContext();
31
- const userConfig = api.useResolvedConfigContext();
32
24
  return {
33
25
  commands: ({
34
26
  program
35
27
  }) => {
36
- program.command('test').allowUnknownOption().usage('[options]').action(async () => {
28
+ program.command('test').allowUnknownOption().usage('<regexForTestFiles> --[options]').action(async () => {
37
29
  await test(api);
38
30
  });
39
31
  },
@@ -43,6 +35,7 @@ export default (() => {
43
35
  },
44
36
 
45
37
  config() {
38
+ const appContext = api.useAppContext();
46
39
  testingExportsUtils = createRuntimeExportsUtils(appContext.internalDirectory, 'testing');
47
40
  return {
48
41
  source: {
@@ -59,13 +52,15 @@ export default (() => {
59
52
  },
60
53
 
61
54
  jestConfig: async (utils, next) => {
62
- const existSrc = await fs.pathExists(appContext.srcDirectory);
55
+ const appContext = api.useAppContext();
56
+ const userConfig = api.useResolvedConfigContext();
57
+ const apiOnly = await isApiOnly(appContext.appDirectory);
63
58
 
64
- if (!existSrc) {
59
+ if (apiOnly) {
65
60
  return next(utils);
66
61
  }
67
62
 
68
- const webpackConfig = getWebpackConfig(WebpackConfigTarget.CLIENT);
63
+ const webpackConfig = getWebpackConfig(WebpackConfigTarget.CLIENT, appContext, userConfig);
69
64
  const {
70
65
  resolve: {
71
66
  alias = {}
@@ -77,9 +72,7 @@ export default (() => {
77
72
  },
78
73
  moduleNameMapper: getModuleNameMapper(alias),
79
74
  testEnvironment: 'jsdom',
80
- resolver: DEFAULT_RESOLVER_PATH
81
- });
82
- utils.setJestConfig({
75
+ resolver: DEFAULT_RESOLVER_PATH,
83
76
  rootDir: appContext.appDirectory || process.cwd(),
84
77
  // todo: diffrent test root for diffrent solutions
85
78
  // testMatch: [`<rootDir>/(src|tests|electron)/**/*.test.[jt]s?(x)`],
@@ -22,15 +22,11 @@ var _test = _interopRequireDefault(require("./test"));
22
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
23
 
24
24
  const mergeUserJestConfig = testUtils => {
25
- const resolveJestConfig = testUtils.testConfig.jest;
25
+ const resolveJestConfig = testUtils.testConfig.jest; // resolveJestConfig 如果是函数类型,在所有测试插件 jestConfig 都执行后,再执行生成最终配置
26
26
 
27
27
  if (resolveJestConfig && typeof resolveJestConfig !== 'function') {
28
28
  testUtils.mergeJestConfig(resolveJestConfig);
29
29
  }
30
-
31
- if (typeof resolveJestConfig === 'function') {
32
- resolveJestConfig(testUtils.jestConfig);
33
- }
34
30
  };
35
31
 
36
32
  exports.mergeUserJestConfig = mergeUserJestConfig;
@@ -41,18 +37,14 @@ var _default = () => {
41
37
  name: '@modern-js/plugin-testing',
42
38
  usePlugins: [BffPlugin],
43
39
  post: [BffPlugin.name],
44
- registerHook: {
45
- jestConfig: _testing.jestConfigHook
46
- },
40
+ registerHook: _testing.testingHooks,
47
41
  setup: api => {
48
42
  let testingExportsUtils;
49
- const appContext = api.useAppContext();
50
- const userConfig = api.useResolvedConfigContext();
51
43
  return {
52
44
  commands: ({
53
45
  program
54
46
  }) => {
55
- program.command('test').allowUnknownOption().usage('[options]').action(async () => {
47
+ program.command('test').allowUnknownOption().usage('<regexForTestFiles> --[options]').action(async () => {
56
48
  await (0, _test.default)(api);
57
49
  });
58
50
  },
@@ -62,6 +54,7 @@ var _default = () => {
62
54
  },
63
55
 
64
56
  config() {
57
+ const appContext = api.useAppContext();
65
58
  testingExportsUtils = (0, _utils.createRuntimeExportsUtils)(appContext.internalDirectory, 'testing');
66
59
  return {
67
60
  source: {
@@ -79,13 +72,15 @@ var _default = () => {
79
72
  },
80
73
 
81
74
  jestConfig: async (utils, next) => {
82
- const existSrc = await _utils.fs.pathExists(appContext.srcDirectory);
75
+ const appContext = api.useAppContext();
76
+ const userConfig = api.useResolvedConfigContext();
77
+ const apiOnly = await (0, _utils.isApiOnly)(appContext.appDirectory);
83
78
 
84
- if (!existSrc) {
79
+ if (apiOnly) {
85
80
  return next(utils);
86
81
  }
87
82
 
88
- const webpackConfig = (0, _webpack.getWebpackConfig)(_webpack.WebpackConfigTarget.CLIENT);
83
+ const webpackConfig = (0, _webpack.getWebpackConfig)(_webpack.WebpackConfigTarget.CLIENT, appContext, userConfig);
89
84
  const {
90
85
  resolve: {
91
86
  alias = {}
@@ -97,9 +92,7 @@ var _default = () => {
97
92
  },
98
93
  moduleNameMapper: (0, _testing.getModuleNameMapper)(alias),
99
94
  testEnvironment: 'jsdom',
100
- resolver: _testing.DEFAULT_RESOLVER_PATH
101
- });
102
- utils.setJestConfig({
95
+ resolver: _testing.DEFAULT_RESOLVER_PATH,
103
96
  rootDir: appContext.appDirectory || process.cwd(),
104
97
  // todo: diffrent test root for diffrent solutions
105
98
  // testMatch: [`<rootDir>/(src|tests|electron)/**/*.test.[jt]s?(x)`],
@@ -7,22 +7,18 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
7
7
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
8
8
 
9
9
  import path from 'path';
10
- import { fs, PLUGIN_SCHEMAS, createRuntimeExportsUtils } from '@modern-js/utils';
11
- import { jestConfigHook, getModuleNameMapper, DEFAULT_RESOLVER_PATH } from '@modern-js/testing';
10
+ import { PLUGIN_SCHEMAS, createRuntimeExportsUtils, isApiOnly } from '@modern-js/utils';
11
+ import { testingHooks, getModuleNameMapper, DEFAULT_RESOLVER_PATH } from '@modern-js/testing';
12
12
  import { getWebpackConfig, WebpackConfigTarget } from '@modern-js/webpack';
13
13
  import TestingBffPlugin from '@modern-js/testing-plugin-bff';
14
14
  import { MODERNJS_CONFIG_KEY } from "../constant";
15
15
  import test from "./test";
16
16
  export var mergeUserJestConfig = function mergeUserJestConfig(testUtils) {
17
- var resolveJestConfig = testUtils.testConfig.jest;
17
+ var resolveJestConfig = testUtils.testConfig.jest; // resolveJestConfig 如果是函数类型,在所有测试插件 jestConfig 都执行后,再执行生成最终配置
18
18
 
19
19
  if (resolveJestConfig && typeof resolveJestConfig !== 'function') {
20
20
  testUtils.mergeJestConfig(resolveJestConfig);
21
21
  }
22
-
23
- if (typeof resolveJestConfig === 'function') {
24
- resolveJestConfig(testUtils.jestConfig);
25
- }
26
22
  };
27
23
  export default (function () {
28
24
  var BffPlugin = TestingBffPlugin();
@@ -30,17 +26,13 @@ export default (function () {
30
26
  name: '@modern-js/plugin-testing',
31
27
  usePlugins: [BffPlugin],
32
28
  post: [BffPlugin.name],
33
- registerHook: {
34
- jestConfig: jestConfigHook
35
- },
29
+ registerHook: testingHooks,
36
30
  setup: function setup(api) {
37
31
  var testingExportsUtils;
38
- var appContext = api.useAppContext();
39
- var userConfig = api.useResolvedConfigContext();
40
32
  return {
41
33
  commands: function commands(_ref) {
42
34
  var program = _ref.program;
43
- program.command('test').allowUnknownOption().usage('[options]').action( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
35
+ program.command('test').allowUnknownOption().usage('<regexForTestFiles> --[options]').action( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
44
36
  return _regeneratorRuntime.wrap(function _callee$(_context) {
45
37
  while (1) {
46
38
  switch (_context.prev = _context.next) {
@@ -60,6 +52,7 @@ export default (function () {
60
52
  return PLUGIN_SCHEMAS['@modern-js/plugin-testing'];
61
53
  },
62
54
  config: function config() {
55
+ var appContext = api.useAppContext();
63
56
  testingExportsUtils = createRuntimeExportsUtils(appContext.internalDirectory, 'testing');
64
57
  return {
65
58
  source: {
@@ -75,35 +68,35 @@ export default (function () {
75
68
  },
76
69
  jestConfig: function () {
77
70
  var _jestConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(utils, next) {
78
- var existSrc, webpackConfig, _webpackConfig$resolv, alias;
71
+ var appContext, userConfig, apiOnly, webpackConfig, _webpackConfig$resolv, alias;
79
72
 
80
73
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
81
74
  while (1) {
82
75
  switch (_context2.prev = _context2.next) {
83
76
  case 0:
84
- _context2.next = 2;
85
- return fs.pathExists(appContext.srcDirectory);
77
+ appContext = api.useAppContext();
78
+ userConfig = api.useResolvedConfigContext();
79
+ _context2.next = 4;
80
+ return isApiOnly(appContext.appDirectory);
86
81
 
87
- case 2:
88
- existSrc = _context2.sent;
82
+ case 4:
83
+ apiOnly = _context2.sent;
89
84
 
90
- if (existSrc) {
91
- _context2.next = 5;
85
+ if (!apiOnly) {
86
+ _context2.next = 7;
92
87
  break;
93
88
  }
94
89
 
95
90
  return _context2.abrupt("return", next(utils));
96
91
 
97
- case 5:
98
- webpackConfig = getWebpackConfig(WebpackConfigTarget.CLIENT);
92
+ case 7:
93
+ webpackConfig = getWebpackConfig(WebpackConfigTarget.CLIENT, appContext, userConfig);
99
94
  _webpackConfig$resolv = webpackConfig.resolve.alias, alias = _webpackConfig$resolv === void 0 ? {} : _webpackConfig$resolv;
100
95
  utils.mergeJestConfig({
101
96
  globals: _defineProperty({}, MODERNJS_CONFIG_KEY, userConfig),
102
97
  moduleNameMapper: getModuleNameMapper(alias),
103
98
  testEnvironment: 'jsdom',
104
- resolver: DEFAULT_RESOLVER_PATH
105
- });
106
- utils.setJestConfig({
99
+ resolver: DEFAULT_RESOLVER_PATH,
107
100
  rootDir: appContext.appDirectory || process.cwd(),
108
101
  // todo: diffrent test root for diffrent solutions
109
102
  // testMatch: [`<rootDir>/(src|tests|electron)/**/*.test.[jt]s?(x)`],
@@ -113,7 +106,7 @@ export default (function () {
113
106
  mergeUserJestConfig(utils);
114
107
  return _context2.abrupt("return", next(utils));
115
108
 
116
- case 11:
109
+ case 12:
117
110
  case "end":
118
111
  return _context2.stop();
119
112
  }
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.4.2",
14
+ "version": "1.5.2",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -19,19 +19,18 @@
19
19
  "jsnext:modern": "./dist/js/modern/index.js",
20
20
  "exports": {
21
21
  "./types": {
22
- "jsnext:source": "./type.d.ts",
23
- "default": "./type.d.ts"
22
+ "jsnext:source": "./types/index.d.ts",
23
+ "default": "./types/index.d.ts"
24
24
  },
25
25
  "./type": {
26
- "jsnext:source": "./type.d.ts",
27
- "default": "./type.d.ts"
26
+ "jsnext:source": "./types/index.d.ts",
27
+ "default": "./types/index.d.ts"
28
28
  },
29
29
  ".": {
30
30
  "node": {
31
31
  "jsnext:source": "./src/runtime-testing/index.ts",
32
32
  "import": "./dist/js/modern/runtime-testing/index.js",
33
- "require": "./dist/js/node/runtime-testing/index.js",
34
- "types": "./types/index.d.ts"
33
+ "require": "./dist/js/node/runtime-testing/index.js"
35
34
  },
36
35
  "default": "./dist/js/treeshaking/runtime-testing/index.js"
37
36
  },
@@ -39,8 +38,7 @@
39
38
  "jsnext:source": "./src/runtime-testing/index.ts",
40
39
  "node": {
41
40
  "import": "./dist/js/modern/runtime-testing/index.js",
42
- "require": "./dist/js/node/runtime-testing/index.js",
43
- "types": "./types/index.d.ts"
41
+ "require": "./dist/js/node/runtime-testing/index.js"
44
42
  },
45
43
  "default": "./dist/js/treeshaking/runtime-testing/index.js"
46
44
  },
@@ -48,8 +46,7 @@
48
46
  "jsnext:source": "./src/runtime-testing/base.ts",
49
47
  "node": {
50
48
  "import": "./dist/js/modern/runtime-testing/base.js",
51
- "require": "./dist/js/node/runtime-testing/base.js",
52
- "types": "./types/base.d.ts"
49
+ "require": "./dist/js/node/runtime-testing/base.js"
53
50
  },
54
51
  "default": "./dist/js/treeshaking/runtime-testing/base.js"
55
52
  },
@@ -70,10 +67,10 @@
70
67
  "./dist/types/runtime-testing/index.d.ts"
71
68
  ],
72
69
  "type": [
73
- "./type.d.ts"
70
+ "./types/index.d.ts"
74
71
  ],
75
72
  "types": [
76
- "./type.d.ts"
73
+ "./types/index.d.ts"
77
74
  ],
78
75
  "runtime-base": [
79
76
  "./dist/types/runtime-testing/base.d.ts"
@@ -81,52 +78,48 @@
81
78
  }
82
79
  },
83
80
  "dependencies": {
81
+ "@babel/core": "7.16.7",
84
82
  "@babel/preset-env": "^7.15.6",
85
83
  "@babel/runtime": "^7",
86
- "@modern-js/babel-compiler": "^1.2.1",
87
- "@modern-js/testing": "^1.4.2",
88
- "@modern-js/utils": "^1.4.0",
89
- "@modern-js/webpack": "^1.5.4",
84
+ "@modern-js-reduck/plugin-auto-actions": "^1.0.2",
85
+ "@modern-js-reduck/plugin-effects": "^1.0.2",
86
+ "@modern-js-reduck/plugin-immutable": "^1.0.1",
87
+ "@modern-js-reduck/store": "^1.0.3",
88
+ "@modern-js/babel-compiler": "^1.2.3",
89
+ "@modern-js/bff-utils": "^1.2.4",
90
+ "@modern-js/runtime-core": "^1.4.3",
91
+ "@modern-js/testing": "^1.4.4",
92
+ "@modern-js/testing-plugin-bff": "^1.4.1",
93
+ "@modern-js/utils": "^1.6.0",
94
+ "@modern-js/webpack": "^1.5.7",
90
95
  "@testing-library/jest-dom": "^5.14.1",
91
96
  "@testing-library/react": "^12.0.0",
92
- "@modern-js/testing-plugin-bff": "^1.3.1"
93
- },
94
- "peerDependencies": {
95
- "@modern-js-reduck/plugin-auto-actions": "^1.0.0",
96
- "@modern-js-reduck/plugin-effects": "^1.0.0",
97
- "@modern-js-reduck/plugin-immutable": "^1.0.0",
98
- "@modern-js-reduck/store": "^1.0.0",
99
- "@modern-js/runtime-core": "^1.4.1"
97
+ "@types/testing-library__jest-dom": "^5.14.3"
100
98
  },
101
99
  "devDependencies": {
102
- "@modern-js-reduck/plugin-auto-actions": "^1.0.0",
103
- "@modern-js-reduck/plugin-effects": "^1.0.0",
104
- "@modern-js-reduck/plugin-immutable": "^1.0.0",
105
- "@modern-js-reduck/store": "^1.0.0",
100
+ "@modern-js/core": "1.9.0",
106
101
  "@scripts/build": "0.0.0",
107
- "@modern-js/core": "1.7.0",
108
- "@modern-js/runtime-core": "1.4.1",
102
+ "@scripts/jest-config": "0.0.0",
109
103
  "@types/jest": "^26",
110
104
  "@types/node": "^14",
111
105
  "@types/react": "^17",
112
106
  "@types/react-dom": "^17",
107
+ "jest": "^27",
113
108
  "react": "^17",
114
109
  "react-dom": "^17",
115
- "typescript": "^4",
116
- "jest": "^27",
117
- "@scripts/jest-config": "0.0.0"
110
+ "typescript": "^4"
118
111
  },
119
112
  "sideEffects": false,
120
113
  "modernConfig": {},
121
114
  "publishConfig": {
122
115
  "registry": "https://registry.npmjs.org/",
123
- "access": "public"
116
+ "access": "public",
117
+ "types": "./dist/types/index.d.ts"
124
118
  },
125
119
  "scripts": {
126
120
  "new": "modern new",
127
121
  "dev": "modern build --watch",
128
122
  "build": "modern build",
129
123
  "test": "jest --passWithNoTests"
130
- },
131
- "readme": "\n<p align=\"center\">\n <a href=\"https://modernjs.dev\" target=\"blank\"><img src=\"https://lf3-static.bytednsdoc.com/obj/eden-cn/ylaelkeh7nuhfnuhf/modernjs-cover.png\" width=\"300\" alt=\"Modern.js Logo\" /></a>\n</p>\n<p align=\"center\">\n现代 Web 工程体系\n <br/>\n <a href=\"https://modernjs.dev\" target=\"blank\">\n modernjs.dev\n </a>\n</p>\n<p align=\"center\">\n The meta-framework suite designed from scratch for frontend-focused modern web development\n</p>\n\n# Introduction\n\n> The doc site ([modernjs.dev](https://modernjs.dev)) and articles are only available in Chinese for now, we are planning to add English versions soon.\n\n- [Modern.js: Hello, World!](https://zhuanlan.zhihu.com/p/426707646)\n\n## Getting Started\n\n- [Quick Start](https://modernjs.dev/docs/start)\n- [Guides](https://modernjs.dev/docs/guides)\n- [API References](https://modernjs.dev/docs/apis)\n\n## Contributing\n\n- [Contributing Guide](https://github.com/modern-js-dev/modern.js/blob/main/CONTRIBUTING.md)\n"
124
+ }
132
125
  }
@@ -1,8 +1,8 @@
1
1
  import "@testing-library/react"
2
2
  import "@testing-library/jest-dom"
3
- import "./dist/types/runtime-testing"
3
+ import "../dist/types/runtime-testing"
4
4
 
5
5
  declare module '@modern-js/runtime/testing' {
6
6
  export * from '@testing-library/react';
7
- export { renderApp, createStore, testBff } from './dist/types/runtime-testing';
7
+ export { renderApp, createStore, testBff } from '../dist/types/runtime-testing';
8
8
  }
@@ -1,6 +0,0 @@
1
- module.exports = {
2
- extends: ['@modern-js'],
3
- parserOptions: {
4
- project: require.resolve('./tsconfig.json'),
5
- },
6
- };
@@ -1,7 +0,0 @@
1
- import { createStore } from '../src';
2
-
3
- describe('plugin-testing', () => {
4
- it('default', () => {
5
- expect(createStore).toBeDefined();
6
- });
7
- });
@@ -1,54 +0,0 @@
1
- import { mergeUserJestConfig } from '../src/cli';
2
-
3
- describe('mergeUserJestConfig', () => {
4
- test('mergeUserJestConfig support object', () => {
5
- const testUtils: any = {
6
- _jestConfig: {
7
- a: 1,
8
- },
9
- get jestConfig() {
10
- return this._jestConfig;
11
- },
12
- testConfig: {
13
- jest: {
14
- b: 1,
15
- },
16
- },
17
- mergeJestConfig(config: Record<string, string>) {
18
- Object.assign(this._jestConfig, config);
19
- },
20
- };
21
-
22
- mergeUserJestConfig(testUtils);
23
-
24
- expect(testUtils.jestConfig).toEqual({
25
- a: 1,
26
- b: 1,
27
- });
28
- });
29
-
30
- test('mergeUserJestConfig support function', () => {
31
- const testUtils: any = {
32
- _jestConfig: {
33
- a: 1,
34
- },
35
- get jestConfig() {
36
- return this._jestConfig;
37
- },
38
- testConfig: {
39
- jest: (jestConfig: Record<string, number>) => {
40
- jestConfig.b = 1;
41
- },
42
- },
43
- mergeJestConfig(config: Record<string, string>) {
44
- Object.assign(this._jestConfig, config);
45
- },
46
- };
47
-
48
- mergeUserJestConfig(testUtils);
49
- expect(testUtils.jestConfig).toEqual({
50
- a: 1,
51
- b: 1,
52
- });
53
- });
54
- });
@@ -1,13 +0,0 @@
1
- {
2
- "extends": "@modern-js/tsconfig/base",
3
- "compilerOptions": {
4
- "declaration": true,
5
- "jsx": "preserve",
6
- "baseUrl": "./",
7
- "outDir": "./out",
8
- "emitDeclarationOnly": true,
9
- "isolatedModules": true,
10
- "paths": {},
11
- "types": ["node", "jest"]
12
- }
13
- }