@modern-js/plugin-testing 1.3.1 → 1.3.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 +9 -0
- package/dist/js/modern/cli/resolver.js +1 -1
- package/dist/js/node/cli/resolver.js +1 -1
- package/dist/js/treeshaking/cli/resolver.js +1 -1
- package/package.json +2 -2
- package/tests/.eslintrc.js +6 -0
- package/tests/resolver.test.ts +30 -0
- package/tests/tsconfig.json +13 -0
- package/type.d.ts +5 -1
package/CHANGELOG.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import enhanceResolve from 'enhanced-resolve';
|
2
2
|
const resolver = enhanceResolve.create.sync({
|
3
|
-
conditionNames: ['
|
3
|
+
conditionNames: ['require', 'node', 'default'],
|
4
4
|
extensions: ['.js', '.json', '.node', '.ts', '.tsx']
|
5
5
|
});
|
6
6
|
|
@@ -5,7 +5,7 @@ var _enhancedResolve = _interopRequireDefault(require("enhanced-resolve"));
|
|
5
5
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
6
6
|
|
7
7
|
const resolver = _enhancedResolve.default.create.sync({
|
8
|
-
conditionNames: ['
|
8
|
+
conditionNames: ['require', 'node', 'default'],
|
9
9
|
extensions: ['.js', '.json', '.node', '.ts', '.tsx']
|
10
10
|
});
|
11
11
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import enhanceResolve from 'enhanced-resolve';
|
2
2
|
var resolver = enhanceResolve.create.sync({
|
3
|
-
conditionNames: ['
|
3
|
+
conditionNames: ['require', 'node', 'default'],
|
4
4
|
extensions: ['.js', '.json', '.node', '.ts', '.tsx']
|
5
5
|
});
|
6
6
|
|
package/package.json
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
"modern",
|
12
12
|
"modern.js"
|
13
13
|
],
|
14
|
-
"version": "1.3.
|
14
|
+
"version": "1.3.2",
|
15
15
|
"jsnext:source": "./src/index.ts",
|
16
16
|
"types": "./dist/types/index.d.ts",
|
17
17
|
"main": "./dist/js/node/index.js",
|
@@ -67,7 +67,7 @@
|
|
67
67
|
"@modern-js/babel-compiler": "^1.2.1",
|
68
68
|
"@modern-js/testing": "^1.3.1",
|
69
69
|
"@modern-js/utils": "^1.2.2",
|
70
|
-
"@modern-js/webpack": "^1.2.
|
70
|
+
"@modern-js/webpack": "^1.2.2",
|
71
71
|
"@testing-library/jest-dom": "^5.14.1",
|
72
72
|
"@testing-library/react": "^12.0.0",
|
73
73
|
"enhanced-resolve": "^5.8.3",
|
@@ -0,0 +1,30 @@
|
|
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
|
+
});
|
@@ -0,0 +1,13 @@
|
|
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
|
+
}
|
package/type.d.ts
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
import '@modern-js/core';
|
2
|
+
import "@testing-library/react"
|
3
|
+
import "@testing-library/jest-dom"
|
4
|
+
import "./dist/types/runtime-testing"
|
5
|
+
|
2
6
|
declare module '@modern-js/runtime/testing' {
|
3
7
|
export * from '@testing-library/react';
|
4
|
-
export { renderApp, createStore } from '
|
8
|
+
export { renderApp, createStore } from './dist/types/runtime-testing';
|
5
9
|
}
|
6
10
|
|
7
11
|
declare module '@modern-js/core' {
|