@modern-js/plugin-testing 1.4.1 → 1.4.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/CHANGELOG.md +20 -0
- package/dist/js/modern/cli/index.js +2 -2
- package/dist/js/node/cli/index.js +1 -1
- package/dist/js/treeshaking/cli/index.js +2 -2
- package/package.json +8 -9
- package/dist/js/modern/cli/resolver.js +0 -15
- package/dist/js/node/cli/resolver.js +0 -20
- package/dist/js/treeshaking/cli/resolver.js +0 -17
- package/dist/types/cli/resolver.d.ts +0 -1
- package/tests/resolver.test.ts +0 -30
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,25 @@
|
|
1
1
|
# @modern-js/plugin-testing
|
2
2
|
|
3
|
+
## 1.4.2
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- 77043407: feat: add default enhanced resolver
|
8
|
+
- Updated dependencies [485375ae]
|
9
|
+
- Updated dependencies [ec1b7367]
|
10
|
+
- Updated dependencies [77ff9754]
|
11
|
+
- Updated dependencies [d2d1d6b2]
|
12
|
+
- Updated dependencies [07a4887e]
|
13
|
+
- Updated dependencies [ea2ae711]
|
14
|
+
- Updated dependencies [77043407]
|
15
|
+
- Updated dependencies [17d0cc46]
|
16
|
+
- Updated dependencies [d2d1d6b2]
|
17
|
+
- @modern-js/runtime-core@1.4.1
|
18
|
+
- @modern-js/webpack@1.5.4
|
19
|
+
- @modern-js/utils@1.4.0
|
20
|
+
- @modern-js/testing@1.4.2
|
21
|
+
- @modern-js/testing-plugin-bff@1.3.1
|
22
|
+
|
3
23
|
## 1.4.1
|
4
24
|
|
5
25
|
### Patch Changes
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import path from 'path';
|
2
2
|
import { fs, PLUGIN_SCHEMAS, createRuntimeExportsUtils } from '@modern-js/utils';
|
3
|
-
import { jestConfigHook, getModuleNameMapper } from '@modern-js/testing';
|
3
|
+
import { jestConfigHook, 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";
|
@@ -77,7 +77,7 @@ export default (() => {
|
|
77
77
|
},
|
78
78
|
moduleNameMapper: getModuleNameMapper(alias),
|
79
79
|
testEnvironment: 'jsdom',
|
80
|
-
resolver:
|
80
|
+
resolver: DEFAULT_RESOLVER_PATH
|
81
81
|
});
|
82
82
|
utils.setJestConfig({
|
83
83
|
rootDir: appContext.appDirectory || process.cwd(),
|
@@ -97,7 +97,7 @@ var _default = () => {
|
|
97
97
|
},
|
98
98
|
moduleNameMapper: (0, _testing.getModuleNameMapper)(alias),
|
99
99
|
testEnvironment: 'jsdom',
|
100
|
-
resolver:
|
100
|
+
resolver: _testing.DEFAULT_RESOLVER_PATH
|
101
101
|
});
|
102
102
|
utils.setJestConfig({
|
103
103
|
rootDir: appContext.appDirectory || process.cwd(),
|
@@ -8,7 +8,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
|
|
8
8
|
|
9
9
|
import path from 'path';
|
10
10
|
import { fs, PLUGIN_SCHEMAS, createRuntimeExportsUtils } from '@modern-js/utils';
|
11
|
-
import { jestConfigHook, getModuleNameMapper } from '@modern-js/testing';
|
11
|
+
import { jestConfigHook, 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";
|
@@ -101,7 +101,7 @@ export default (function () {
|
|
101
101
|
globals: _defineProperty({}, MODERNJS_CONFIG_KEY, userConfig),
|
102
102
|
moduleNameMapper: getModuleNameMapper(alias),
|
103
103
|
testEnvironment: 'jsdom',
|
104
|
-
resolver:
|
104
|
+
resolver: DEFAULT_RESOLVER_PATH
|
105
105
|
});
|
106
106
|
utils.setJestConfig({
|
107
107
|
rootDir: appContext.appDirectory || process.cwd(),
|
package/package.json
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
"modern",
|
12
12
|
"modern.js"
|
13
13
|
],
|
14
|
-
"version": "1.4.
|
14
|
+
"version": "1.4.2",
|
15
15
|
"jsnext:source": "./src/index.ts",
|
16
16
|
"types": "./dist/types/index.d.ts",
|
17
17
|
"main": "./dist/js/node/index.js",
|
@@ -84,20 +84,19 @@
|
|
84
84
|
"@babel/preset-env": "^7.15.6",
|
85
85
|
"@babel/runtime": "^7",
|
86
86
|
"@modern-js/babel-compiler": "^1.2.1",
|
87
|
-
"@modern-js/testing": "^1.4.
|
88
|
-
"@modern-js/utils": "^1.
|
89
|
-
"@modern-js/webpack": "^1.5.
|
87
|
+
"@modern-js/testing": "^1.4.2",
|
88
|
+
"@modern-js/utils": "^1.4.0",
|
89
|
+
"@modern-js/webpack": "^1.5.4",
|
90
90
|
"@testing-library/jest-dom": "^5.14.1",
|
91
91
|
"@testing-library/react": "^12.0.0",
|
92
|
-
"
|
93
|
-
"@modern-js/testing-plugin-bff": "^1.3.0"
|
92
|
+
"@modern-js/testing-plugin-bff": "^1.3.1"
|
94
93
|
},
|
95
94
|
"peerDependencies": {
|
96
95
|
"@modern-js-reduck/plugin-auto-actions": "^1.0.0",
|
97
96
|
"@modern-js-reduck/plugin-effects": "^1.0.0",
|
98
97
|
"@modern-js-reduck/plugin-immutable": "^1.0.0",
|
99
98
|
"@modern-js-reduck/store": "^1.0.0",
|
100
|
-
"@modern-js/runtime-core": "^1.4.
|
99
|
+
"@modern-js/runtime-core": "^1.4.1"
|
101
100
|
},
|
102
101
|
"devDependencies": {
|
103
102
|
"@modern-js-reduck/plugin-auto-actions": "^1.0.0",
|
@@ -105,8 +104,8 @@
|
|
105
104
|
"@modern-js-reduck/plugin-immutable": "^1.0.0",
|
106
105
|
"@modern-js-reduck/store": "^1.0.0",
|
107
106
|
"@scripts/build": "0.0.0",
|
108
|
-
"@modern-js/core": "1.
|
109
|
-
"@modern-js/runtime-core": "1.4.
|
107
|
+
"@modern-js/core": "1.7.0",
|
108
|
+
"@modern-js/runtime-core": "1.4.1",
|
110
109
|
"@types/jest": "^26",
|
111
110
|
"@types/node": "^14",
|
112
111
|
"@types/react": "^17",
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import enhanceResolve from 'enhanced-resolve';
|
2
|
-
const resolver = enhanceResolve.create.sync({
|
3
|
-
conditionNames: ['require', 'node', 'default'],
|
4
|
-
extensions: ['.js', '.json', '.node', '.ts', '.tsx']
|
5
|
-
});
|
6
|
-
|
7
|
-
const shouldResolveByEnhance = url => /^@[^/]+\/[^/]+\/.*/.test(url);
|
8
|
-
|
9
|
-
module.exports = function (request, options) {
|
10
|
-
if (shouldResolveByEnhance(request)) {
|
11
|
-
return resolver(options.basedir, request);
|
12
|
-
}
|
13
|
-
|
14
|
-
return options.defaultResolver(request, options);
|
15
|
-
};
|
@@ -1,20 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _enhancedResolve = _interopRequireDefault(require("enhanced-resolve"));
|
4
|
-
|
5
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
6
|
-
|
7
|
-
const resolver = _enhancedResolve.default.create.sync({
|
8
|
-
conditionNames: ['require', 'node', 'default'],
|
9
|
-
extensions: ['.js', '.json', '.node', '.ts', '.tsx']
|
10
|
-
});
|
11
|
-
|
12
|
-
const shouldResolveByEnhance = url => /^@[^/]+\/[^/]+\/.*/.test(url);
|
13
|
-
|
14
|
-
module.exports = function (request, options) {
|
15
|
-
if (shouldResolveByEnhance(request)) {
|
16
|
-
return resolver(options.basedir, request);
|
17
|
-
}
|
18
|
-
|
19
|
-
return options.defaultResolver(request, options);
|
20
|
-
};
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import enhanceResolve from 'enhanced-resolve';
|
2
|
-
var resolver = enhanceResolve.create.sync({
|
3
|
-
conditionNames: ['require', 'node', 'default'],
|
4
|
-
extensions: ['.js', '.json', '.node', '.ts', '.tsx']
|
5
|
-
});
|
6
|
-
|
7
|
-
var shouldResolveByEnhance = function shouldResolveByEnhance(url) {
|
8
|
-
return /^@[^/]+\/[^/]+\/.*/.test(url);
|
9
|
-
};
|
10
|
-
|
11
|
-
module.exports = function (request, options) {
|
12
|
-
if (shouldResolveByEnhance(request)) {
|
13
|
-
return resolver(options.basedir, request);
|
14
|
-
}
|
15
|
-
|
16
|
-
return options.defaultResolver(request, options);
|
17
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
package/tests/resolver.test.ts
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
import path from 'path';
|
2
|
-
import { fs } from '@modern-js/utils';
|
3
|
-
|
4
|
-
const resolver = require('../src/cli/resolver');
|
5
|
-
|
6
|
-
describe('plugin-testing', () => {
|
7
|
-
it('resolver', () => {
|
8
|
-
const moduleDir = path.join(
|
9
|
-
__dirname,
|
10
|
-
'node_modules/@modern-js/runtime/module',
|
11
|
-
);
|
12
|
-
fs.ensureDirSync(moduleDir);
|
13
|
-
fs.writeJSONSync(
|
14
|
-
path.join(moduleDir, 'package.json'),
|
15
|
-
{
|
16
|
-
name: '@modern-js/runtime/module',
|
17
|
-
main: './index.js',
|
18
|
-
},
|
19
|
-
'utf-8',
|
20
|
-
);
|
21
|
-
fs.writeFileSync(
|
22
|
-
path.join(moduleDir, 'index.js'),
|
23
|
-
'module.exports = "@modern-js/runtime/module"',
|
24
|
-
'utf-8',
|
25
|
-
);
|
26
|
-
expect(
|
27
|
-
resolver('@modern-js/runtime/module', { basedir: __dirname }),
|
28
|
-
).toContain('module');
|
29
|
-
});
|
30
|
-
});
|