@modern-js/plugin-testing 1.0.0 → 1.1.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 +7 -0
- package/CHANGELOG.md +34 -0
- package/README.md +1 -4
- package/dist/js/modern/cli/index.js +2 -1
- package/dist/js/modern/cli/plugins/modern.js +4 -4
- package/dist/js/modern/cli/test.js +2 -3
- package/dist/js/node/cli/index.js +3 -1
- package/dist/js/node/cli/plugins/modern.js +7 -4
- package/dist/js/node/cli/test.js +3 -3
- package/dist/js/treeshaking/cli/index.js +2 -1
- package/dist/js/treeshaking/cli/plugins/modern.js +4 -4
- package/dist/js/treeshaking/cli/test.js +2 -3
- package/package.json +11 -11
- package/src/cli/index.ts +1 -1
- package/src/cli/plugins/modern.ts +4 -8
- package/src/cli/test.ts +2 -3
package/.eslintrc.js
ADDED
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,39 @@
|
|
1
1
|
# @modern-js/plugin-testing
|
2
2
|
|
3
|
+
## 1.1.1
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- 0fa83663: support more .env files
|
8
|
+
- Updated dependencies [6f7fe574]
|
9
|
+
- Updated dependencies [e4755134]
|
10
|
+
- Updated dependencies [0fa83663]
|
11
|
+
- Updated dependencies [19b4f79e]
|
12
|
+
- Updated dependencies [f594fbc8]
|
13
|
+
- Updated dependencies [d1fde77a]
|
14
|
+
- @modern-js/core@1.1.2
|
15
|
+
- @modern-js/webpack@1.1.2
|
16
|
+
- @modern-js/testing@1.1.1
|
17
|
+
- @modern-js/runtime-core@1.1.1
|
18
|
+
- @modern-js/babel-compiler@1.1.2
|
19
|
+
- @modern-js/utils@1.1.2
|
20
|
+
|
21
|
+
## 1.1.0
|
22
|
+
|
23
|
+
### Minor Changes
|
24
|
+
|
25
|
+
- 96119db2: Relese v1.1.0
|
26
|
+
|
27
|
+
### Patch Changes
|
28
|
+
|
29
|
+
- Updated dependencies [96119db2]
|
30
|
+
- @modern-js/core@1.1.0
|
31
|
+
- @modern-js/webpack@1.1.0
|
32
|
+
- @modern-js/testing@1.1.0
|
33
|
+
- @modern-js/runtime-core@1.1.0
|
34
|
+
- @modern-js/babel-compiler@1.1.0
|
35
|
+
- @modern-js/utils@1.1.0
|
36
|
+
|
3
37
|
## 1.0.0
|
4
38
|
|
5
39
|
### Patch Changes
|
package/README.md
CHANGED
@@ -17,10 +17,7 @@
|
|
17
17
|
|
18
18
|
> 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.
|
19
19
|
|
20
|
-
-
|
21
|
-
- [迈入现代 Web 开发](https://zhuanlan.zhihu.com/p/386607009)
|
22
|
-
- [现代 Web 开发者问卷调查报告](https://zhuanlan.zhihu.com/p/403206195)
|
23
|
-
- [字节跳动是如何落地微前端的](https://mp.weixin.qq.com/s/L9wbfNG5fTXF5bx7dcgj4Q)
|
20
|
+
- [Modern.js: Hello, World!](https://zhuanlan.zhihu.com/p/426707646)
|
24
21
|
|
25
22
|
## Getting Started
|
26
23
|
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import
|
1
|
+
import path from 'path';
|
2
|
+
import { createRuntimeExportsUtils, PLUGIN_SCHEMAS } from '@modern-js/utils';
|
2
3
|
import { createPlugin, useAppContext } from '@modern-js/core';
|
3
4
|
import test from "./test";
|
4
5
|
export default createPlugin(() => {
|
@@ -1,7 +1,6 @@
|
|
1
|
-
import
|
1
|
+
import path from 'path';
|
2
2
|
import { createPlugin } from '@modern-js/testing';
|
3
3
|
import { modernjs_config_key } from "../../constant";
|
4
|
-
import { upath } from '@modern-js/utils';
|
5
4
|
|
6
5
|
const getModuleNameMapper = config => {
|
7
6
|
const {
|
@@ -37,11 +36,12 @@ export default ((webpackConfig, userConfig, pwd) => createPlugin(() => ({
|
|
37
36
|
},
|
38
37
|
moduleNameMapper: getModuleNameMapper(webpackConfig),
|
39
38
|
testEnvironment: 'jsdom',
|
40
|
-
resolver:
|
39
|
+
resolver: require.resolve("../resolver")
|
41
40
|
});
|
42
41
|
utils.setJestConfig({
|
42
|
+
rootDir: pwd || process.cwd(),
|
43
43
|
// todo: diffrent test root for diffrent solutions
|
44
|
-
testMatch: [
|
44
|
+
testMatch: [`**/(src|tests|api|electron)/**/*.test.[jt]s?(x)`]
|
45
45
|
});
|
46
46
|
return next(utils);
|
47
47
|
}
|
@@ -1,6 +1,5 @@
|
|
1
|
-
import
|
1
|
+
import path from 'path';
|
2
2
|
import { compiler } from '@modern-js/babel-compiler';
|
3
|
-
import { upath } from '@modern-js/utils';
|
4
3
|
import { useAppContext, useResolvedConfigContext } from '@modern-js/core';
|
5
4
|
import { runTest } from '@modern-js/testing';
|
6
5
|
import { getWebpackConfig, WebpackConfigTarget } from '@modern-js/webpack'; // import testingBffPlugin from '@modern-js/testing-plugin-bff';
|
@@ -30,7 +29,7 @@ const test = async () => {
|
|
30
29
|
distDir: runtimeExportsPath,
|
31
30
|
quiet: true
|
32
31
|
}, {
|
33
|
-
presets: [[
|
32
|
+
presets: [[require.resolve('@babel/preset-env'), {
|
34
33
|
modules: 'cjs'
|
35
34
|
}]]
|
36
35
|
});
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
7
|
|
8
|
+
var _path = _interopRequireDefault(require("path"));
|
9
|
+
|
8
10
|
var _utils = require("@modern-js/utils");
|
9
11
|
|
10
12
|
var _core = require("@modern-js/core");
|
@@ -42,7 +44,7 @@ var _default = (0, _core.createPlugin)(() => {
|
|
42
44
|
},
|
43
45
|
|
44
46
|
addRuntimeExports() {
|
45
|
-
const testingPath =
|
47
|
+
const testingPath = _path.default.resolve(__dirname, '../');
|
46
48
|
|
47
49
|
testingExportsUtils.addExport(`export * from '${testingPath}'`);
|
48
50
|
}
|
@@ -5,12 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
7
|
|
8
|
-
var
|
8
|
+
var _path = _interopRequireDefault(require("path"));
|
9
9
|
|
10
10
|
var _testing = require("@modern-js/testing");
|
11
11
|
|
12
12
|
var _constant = require("../../constant");
|
13
13
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
|
+
|
14
16
|
const getModuleNameMapper = config => {
|
15
17
|
const {
|
16
18
|
resolve: {
|
@@ -32,7 +34,7 @@ const getModuleNameMapper = config => {
|
|
32
34
|
|
33
35
|
const key = `^${cur}/(.*)$`;
|
34
36
|
|
35
|
-
const value =
|
37
|
+
const value = _path.default.normalize(`${aliasValue}/$1`);
|
36
38
|
|
37
39
|
memo[key] = value;
|
38
40
|
return memo;
|
@@ -47,11 +49,12 @@ var _default = (webpackConfig, userConfig, pwd) => (0, _testing.createPlugin)(()
|
|
47
49
|
},
|
48
50
|
moduleNameMapper: getModuleNameMapper(webpackConfig),
|
49
51
|
testEnvironment: 'jsdom',
|
50
|
-
resolver:
|
52
|
+
resolver: require.resolve("../resolver")
|
51
53
|
});
|
52
54
|
utils.setJestConfig({
|
55
|
+
rootDir: pwd || process.cwd(),
|
53
56
|
// todo: diffrent test root for diffrent solutions
|
54
|
-
testMatch: [
|
57
|
+
testMatch: [`**/(src|tests|api|electron)/**/*.test.[jt]s?(x)`]
|
55
58
|
});
|
56
59
|
return next(utils);
|
57
60
|
}
|
package/dist/js/node/cli/test.js
CHANGED
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
7
|
|
8
|
-
var
|
8
|
+
var _path = _interopRequireDefault(require("path"));
|
9
9
|
|
10
10
|
var _babelCompiler = require("@modern-js/babel-compiler");
|
11
11
|
|
@@ -37,7 +37,7 @@ const test = async () => {
|
|
37
37
|
// }),
|
38
38
|
];
|
39
39
|
|
40
|
-
const runtimeExportsPath =
|
40
|
+
const runtimeExportsPath = _path.default.join(config.internalDirectory, '.runtime-exports');
|
41
41
|
|
42
42
|
await (0, _babelCompiler.compiler)({
|
43
43
|
sourceDir: runtimeExportsPath,
|
@@ -45,7 +45,7 @@ const test = async () => {
|
|
45
45
|
distDir: runtimeExportsPath,
|
46
46
|
quiet: true
|
47
47
|
}, {
|
48
|
-
presets: [[
|
48
|
+
presets: [[require.resolve('@babel/preset-env'), {
|
49
49
|
modules: 'cjs'
|
50
50
|
}]]
|
51
51
|
});
|
@@ -4,7 +4,8 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
|
|
4
4
|
|
5
5
|
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); }); }; }
|
6
6
|
|
7
|
-
import
|
7
|
+
import path from 'path';
|
8
|
+
import { createRuntimeExportsUtils, PLUGIN_SCHEMAS } from '@modern-js/utils';
|
8
9
|
import { createPlugin, useAppContext } from '@modern-js/core';
|
9
10
|
import test from "./test";
|
10
11
|
export default createPlugin(function () {
|
@@ -1,9 +1,8 @@
|
|
1
1
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
2
2
|
|
3
|
-
import
|
3
|
+
import path from 'path';
|
4
4
|
import { createPlugin } from '@modern-js/testing';
|
5
5
|
import { modernjs_config_key } from "../../constant";
|
6
|
-
import { upath } from '@modern-js/utils';
|
7
6
|
|
8
7
|
var getModuleNameMapper = function getModuleNameMapper(config) {
|
9
8
|
var _config$resolve$alias = config.resolve.alias,
|
@@ -38,11 +37,12 @@ export default (function (webpackConfig, userConfig, pwd) {
|
|
38
37
|
globals: _defineProperty({}, modernjs_config_key, userConfig),
|
39
38
|
moduleNameMapper: getModuleNameMapper(webpackConfig),
|
40
39
|
testEnvironment: 'jsdom',
|
41
|
-
resolver:
|
40
|
+
resolver: require.resolve("../resolver")
|
42
41
|
});
|
43
42
|
utils.setJestConfig({
|
43
|
+
rootDir: pwd || process.cwd(),
|
44
44
|
// todo: diffrent test root for diffrent solutions
|
45
|
-
testMatch: ["
|
45
|
+
testMatch: ["**/(src|tests|api|electron)/**/*.test.[jt]s?(x)"]
|
46
46
|
});
|
47
47
|
return next(utils);
|
48
48
|
}
|
@@ -16,9 +16,8 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
|
|
16
16
|
|
17
17
|
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); }); }; }
|
18
18
|
|
19
|
-
import
|
19
|
+
import path from 'path';
|
20
20
|
import { compiler } from '@modern-js/babel-compiler';
|
21
|
-
import { upath } from '@modern-js/utils';
|
22
21
|
import { useAppContext, useResolvedConfigContext } from '@modern-js/core';
|
23
22
|
import { runTest } from '@modern-js/testing';
|
24
23
|
import { getWebpackConfig, WebpackConfigTarget } from '@modern-js/webpack'; // import testingBffPlugin from '@modern-js/testing-plugin-bff';
|
@@ -55,7 +54,7 @@ var test = /*#__PURE__*/function () {
|
|
55
54
|
distDir: runtimeExportsPath,
|
56
55
|
quiet: true
|
57
56
|
}, {
|
58
|
-
presets: [[
|
57
|
+
presets: [[require.resolve('@babel/preset-env'), {
|
59
58
|
modules: 'cjs'
|
60
59
|
}]]
|
61
60
|
});
|
package/package.json
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
"modern",
|
12
12
|
"modern.js"
|
13
13
|
],
|
14
|
-
"version": "1.
|
14
|
+
"version": "1.1.1",
|
15
15
|
"jsnext:source": "./src/index.ts",
|
16
16
|
"types": "./dist/types/index.d.ts",
|
17
17
|
"main": "./dist/js/node/index.js",
|
@@ -23,10 +23,10 @@
|
|
23
23
|
"dependencies": {
|
24
24
|
"@babel/preset-env": "^7.15.6",
|
25
25
|
"@babel/runtime": "^7",
|
26
|
-
"@modern-js/babel-compiler": "^1.
|
27
|
-
"@modern-js/testing": "^1.
|
28
|
-
"@modern-js/utils": "^1.
|
29
|
-
"@modern-js/webpack": "^1.
|
26
|
+
"@modern-js/babel-compiler": "^1.1.2",
|
27
|
+
"@modern-js/testing": "^1.1.1",
|
28
|
+
"@modern-js/utils": "^1.1.2",
|
29
|
+
"@modern-js/webpack": "^1.1.2",
|
30
30
|
"@testing-library/jest-dom": "^5.14.1",
|
31
31
|
"@testing-library/react": "^12.0.0",
|
32
32
|
"enhanced-resolve": "^5.8.2"
|
@@ -36,18 +36,18 @@
|
|
36
36
|
"@modern-js-reduck/plugin-effects": "^1.0.0",
|
37
37
|
"@modern-js-reduck/plugin-immutable": "^1.0.0",
|
38
38
|
"@modern-js-reduck/store": "^1.0.0",
|
39
|
-
"@modern-js/core": "^1.
|
40
|
-
"@modern-js/runtime-core": "^1.
|
39
|
+
"@modern-js/core": "^1.1.2",
|
40
|
+
"@modern-js/runtime-core": "^1.1.1"
|
41
41
|
},
|
42
42
|
"devDependencies": {
|
43
43
|
"@modern-js-reduck/plugin-auto-actions": "^1.0.0",
|
44
44
|
"@modern-js-reduck/plugin-effects": "^1.0.0",
|
45
45
|
"@modern-js-reduck/plugin-immutable": "^1.0.0",
|
46
46
|
"@modern-js-reduck/store": "^1.0.0",
|
47
|
-
"@modern-js/plugin-testing": "^1.
|
48
|
-
"@modern-js/module-tools": "^1.
|
49
|
-
"@modern-js/core": "^1.
|
50
|
-
"@modern-js/runtime-core": "^1.
|
47
|
+
"@modern-js/plugin-testing": "^1.1.0",
|
48
|
+
"@modern-js/module-tools": "^1.1.0",
|
49
|
+
"@modern-js/core": "^1.1.2",
|
50
|
+
"@modern-js/runtime-core": "^1.1.1",
|
51
51
|
"@types/jest": "^26",
|
52
52
|
"@types/node": "^14",
|
53
53
|
"@types/react": "^17",
|
package/src/cli/index.ts
CHANGED
@@ -1,7 +1,6 @@
|
|
1
|
-
import
|
1
|
+
import path from 'path';
|
2
2
|
import { createPlugin } from '@modern-js/testing';
|
3
3
|
import { modernjs_config_key } from '@/constant';
|
4
|
-
import { upath } from '@modern-js/utils';
|
5
4
|
|
6
5
|
const getModuleNameMapper = (config: any) => {
|
7
6
|
const {
|
@@ -41,16 +40,13 @@ export default (webpackConfig: any, userConfig: any, pwd: string) =>
|
|
41
40
|
},
|
42
41
|
moduleNameMapper: getModuleNameMapper(webpackConfig),
|
43
42
|
testEnvironment: 'jsdom',
|
44
|
-
resolver:
|
43
|
+
resolver: require.resolve('../resolver'),
|
45
44
|
});
|
46
45
|
|
47
46
|
utils.setJestConfig({
|
47
|
+
rootDir: pwd || process.cwd(),
|
48
48
|
// todo: diffrent test root for diffrent solutions
|
49
|
-
testMatch: [
|
50
|
-
`${
|
51
|
-
pwd || process.cwd()
|
52
|
-
}/(src|tests|api|electron)/**/*.test.[jt]s?(x)`,
|
53
|
-
],
|
49
|
+
testMatch: [`**/(src|tests|api|electron)/**/*.test.[jt]s?(x)`],
|
54
50
|
});
|
55
51
|
|
56
52
|
return next(utils);
|
package/src/cli/test.ts
CHANGED
@@ -1,6 +1,5 @@
|
|
1
|
-
import
|
1
|
+
import path from 'path';
|
2
2
|
import { compiler } from '@modern-js/babel-compiler';
|
3
|
-
import { upath } from '@modern-js/utils';
|
4
3
|
import { useAppContext, useResolvedConfigContext } from '@modern-js/core';
|
5
4
|
import { TestConfig, runTest } from '@modern-js/testing';
|
6
5
|
import { getWebpackConfig, WebpackConfigTarget } from '@modern-js/webpack';
|
@@ -52,7 +51,7 @@ const test = async () => {
|
|
52
51
|
{
|
53
52
|
presets: [
|
54
53
|
[
|
55
|
-
|
54
|
+
require.resolve('@babel/preset-env'),
|
56
55
|
{
|
57
56
|
modules: 'cjs',
|
58
57
|
},
|