@modern-js/plugin-testing 1.5.0 → 1.5.1
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 +4 -2
- package/CHANGELOG.md +35 -0
- package/dist/js/modern/cli/index.js +5 -4
- package/dist/js/node/cli/index.js +5 -4
- package/dist/js/treeshaking/cli/index.js +11 -10
- package/package.json +26 -33
- package/{type.d.ts → types/index.d.ts} +2 -2
package/.eslintrc.js
CHANGED
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,40 @@
|
|
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
|
+
|
3
38
|
## 1.5.0
|
4
39
|
|
5
40
|
### Minor Changes
|
@@ -27,8 +27,6 @@ export default (() => {
|
|
27
27
|
},
|
28
28
|
setup: api => {
|
29
29
|
let testingExportsUtils;
|
30
|
-
const appContext = api.useAppContext();
|
31
|
-
const userConfig = api.useResolvedConfigContext();
|
32
30
|
return {
|
33
31
|
commands: ({
|
34
32
|
program
|
@@ -43,6 +41,7 @@ export default (() => {
|
|
43
41
|
},
|
44
42
|
|
45
43
|
config() {
|
44
|
+
const appContext = api.useAppContext();
|
46
45
|
testingExportsUtils = createRuntimeExportsUtils(appContext.internalDirectory, 'testing');
|
47
46
|
return {
|
48
47
|
source: {
|
@@ -59,13 +58,15 @@ export default (() => {
|
|
59
58
|
},
|
60
59
|
|
61
60
|
jestConfig: async (utils, next) => {
|
62
|
-
const
|
61
|
+
const appContext = api.useAppContext();
|
62
|
+
const userConfig = api.useResolvedConfigContext();
|
63
|
+
const apiOnly = await isApiOnly(appContext.appDirectory);
|
63
64
|
|
64
65
|
if (apiOnly) {
|
65
66
|
return next(utils);
|
66
67
|
}
|
67
68
|
|
68
|
-
const webpackConfig = getWebpackConfig(WebpackConfigTarget.CLIENT);
|
69
|
+
const webpackConfig = getWebpackConfig(WebpackConfigTarget.CLIENT, appContext, userConfig);
|
69
70
|
const {
|
70
71
|
resolve: {
|
71
72
|
alias = {}
|
@@ -46,8 +46,6 @@ var _default = () => {
|
|
46
46
|
},
|
47
47
|
setup: api => {
|
48
48
|
let testingExportsUtils;
|
49
|
-
const appContext = api.useAppContext();
|
50
|
-
const userConfig = api.useResolvedConfigContext();
|
51
49
|
return {
|
52
50
|
commands: ({
|
53
51
|
program
|
@@ -62,6 +60,7 @@ var _default = () => {
|
|
62
60
|
},
|
63
61
|
|
64
62
|
config() {
|
63
|
+
const appContext = api.useAppContext();
|
65
64
|
testingExportsUtils = (0, _utils.createRuntimeExportsUtils)(appContext.internalDirectory, 'testing');
|
66
65
|
return {
|
67
66
|
source: {
|
@@ -79,13 +78,15 @@ var _default = () => {
|
|
79
78
|
},
|
80
79
|
|
81
80
|
jestConfig: async (utils, next) => {
|
82
|
-
const
|
81
|
+
const appContext = api.useAppContext();
|
82
|
+
const userConfig = api.useResolvedConfigContext();
|
83
|
+
const apiOnly = await (0, _utils.isApiOnly)(appContext.appDirectory);
|
83
84
|
|
84
85
|
if (apiOnly) {
|
85
86
|
return next(utils);
|
86
87
|
}
|
87
88
|
|
88
|
-
const webpackConfig = (0, _webpack.getWebpackConfig)(_webpack.WebpackConfigTarget.CLIENT);
|
89
|
+
const webpackConfig = (0, _webpack.getWebpackConfig)(_webpack.WebpackConfigTarget.CLIENT, appContext, userConfig);
|
89
90
|
const {
|
90
91
|
resolve: {
|
91
92
|
alias = {}
|
@@ -35,8 +35,6 @@ export default (function () {
|
|
35
35
|
},
|
36
36
|
setup: function setup(api) {
|
37
37
|
var testingExportsUtils;
|
38
|
-
var appContext = api.useAppContext();
|
39
|
-
var userConfig = api.useResolvedConfigContext();
|
40
38
|
return {
|
41
39
|
commands: function commands(_ref) {
|
42
40
|
var program = _ref.program;
|
@@ -60,6 +58,7 @@ export default (function () {
|
|
60
58
|
return PLUGIN_SCHEMAS['@modern-js/plugin-testing'];
|
61
59
|
},
|
62
60
|
config: function config() {
|
61
|
+
var appContext = api.useAppContext();
|
63
62
|
testingExportsUtils = createRuntimeExportsUtils(appContext.internalDirectory, 'testing');
|
64
63
|
return {
|
65
64
|
source: {
|
@@ -75,27 +74,29 @@ export default (function () {
|
|
75
74
|
},
|
76
75
|
jestConfig: function () {
|
77
76
|
var _jestConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(utils, next) {
|
78
|
-
var apiOnly, webpackConfig, _webpackConfig$resolv, alias;
|
77
|
+
var appContext, userConfig, apiOnly, webpackConfig, _webpackConfig$resolv, alias;
|
79
78
|
|
80
79
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
81
80
|
while (1) {
|
82
81
|
switch (_context2.prev = _context2.next) {
|
83
82
|
case 0:
|
84
|
-
|
85
|
-
|
83
|
+
appContext = api.useAppContext();
|
84
|
+
userConfig = api.useResolvedConfigContext();
|
85
|
+
_context2.next = 4;
|
86
|
+
return isApiOnly(appContext.appDirectory);
|
86
87
|
|
87
|
-
case
|
88
|
+
case 4:
|
88
89
|
apiOnly = _context2.sent;
|
89
90
|
|
90
91
|
if (!apiOnly) {
|
91
|
-
_context2.next =
|
92
|
+
_context2.next = 7;
|
92
93
|
break;
|
93
94
|
}
|
94
95
|
|
95
96
|
return _context2.abrupt("return", next(utils));
|
96
97
|
|
97
|
-
case
|
98
|
-
webpackConfig = getWebpackConfig(WebpackConfigTarget.CLIENT);
|
98
|
+
case 7:
|
99
|
+
webpackConfig = getWebpackConfig(WebpackConfigTarget.CLIENT, appContext, userConfig);
|
99
100
|
_webpackConfig$resolv = webpackConfig.resolve.alias, alias = _webpackConfig$resolv === void 0 ? {} : _webpackConfig$resolv;
|
100
101
|
utils.mergeJestConfig({
|
101
102
|
globals: _defineProperty({}, MODERNJS_CONFIG_KEY, userConfig),
|
@@ -113,7 +114,7 @@ export default (function () {
|
|
113
114
|
mergeUserJestConfig(utils);
|
114
115
|
return _context2.abrupt("return", next(utils));
|
115
116
|
|
116
|
-
case
|
117
|
+
case 13:
|
117
118
|
case "end":
|
118
119
|
return _context2.stop();
|
119
120
|
}
|
package/package.json
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
"modern",
|
12
12
|
"modern.js"
|
13
13
|
],
|
14
|
-
"version": "1.5.
|
14
|
+
"version": "1.5.1",
|
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": "./
|
23
|
-
"default": "./
|
22
|
+
"jsnext:source": "./types/index.d.ts",
|
23
|
+
"default": "./types/index.d.ts"
|
24
24
|
},
|
25
25
|
"./type": {
|
26
|
-
"jsnext:source": "./
|
27
|
-
"default": "./
|
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
|
-
"./
|
70
|
+
"./types/index.d.ts"
|
74
71
|
],
|
75
72
|
"types": [
|
76
|
-
"./
|
73
|
+
"./types/index.d.ts"
|
77
74
|
],
|
78
75
|
"runtime-base": [
|
79
76
|
"./dist/types/runtime-testing/base.d.ts"
|
@@ -81,40 +78,36 @@
|
|
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",
|
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",
|
86
88
|
"@modern-js/babel-compiler": "^1.2.3",
|
87
|
-
"@modern-js/
|
88
|
-
"@modern-js/
|
89
|
-
"@modern-js/
|
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
|
-
"@
|
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.2"
|
97
|
+
"@types/testing-library__jest-dom": "^5.14.3"
|
100
98
|
},
|
101
99
|
"devDependencies": {
|
102
|
-
"@modern-js
|
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
|
-
"@
|
108
|
-
"@modern-js/runtime-core": "1.4.2",
|
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": {},
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import "@testing-library/react"
|
2
2
|
import "@testing-library/jest-dom"
|
3
|
-
import "
|
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 '
|
7
|
+
export { renderApp, createStore, testBff } from '../dist/types/runtime-testing';
|
8
8
|
}
|