Skip to content

Commit

Permalink
feat: 优化源码测试
Browse files Browse the repository at this point in the history
  • Loading branch information
winixt committed Aug 13, 2021
1 parent 67b7436 commit 876cac7
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 39 deletions.
6 changes: 2 additions & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ module.exports = {
'no-undefined': 'off',
'vue/valid-template-root': 'off'
},
parserOptions: {
babelOptions: {
presets: ['@babel/preset-env']
}
env: {
jest: true
}
};
6 changes: 0 additions & 6 deletions babel.config.js

This file was deleted.

18 changes: 4 additions & 14 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@

module.exports = {
moduleFileExtensions: [
'js',
'jsx',
'json'
],
transform: {
'\\.[jt]sx?$': 'babel-jest'
},
moduleDirectories: [
'node_modules'
],
transformIgnorePatterns: [
'node_modules/(?!lodash-es)',
'fes-template'
testPathIgnorePatterns: [
'/node_modules/',
'fes-template',
'fes-template-h5'
]
};
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"release": "node scripts/build.js && lerna publish from-git",
"docs:dev": "vuepress dev docs --clean-cache",
"docs:build": "vuepress build docs --clean-cache",
"test": "yarn jest",
"test": "fes test",
"lint": "eslint -c ./.eslintrc.js --ext .js,.jsx,.vue,.ts"
},
"license": "MIT",
Expand All @@ -35,19 +35,19 @@
"@babel/preset-env": "^7.15.0",
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^11.0.0",
"@fesjs/fes": "^2.0.0",
"@fesjs/plugin-jest": "^2.0.0",
"@vuepress/plugin-docsearch": "^2.0.0-beta.22",
"@vuepress/plugin-pwa": "^2.0.0-beta.22",
"@vuepress/plugin-pwa-popup": "^2.0.0-beta.22",
"@webank/eslint-config-webank": "0.3.0",
"babel-jest": "^27.0.6",
"chalk": "^4.1.2",
"chokidar": "^3.5.2",
"commitizen": "^4.2.1",
"cz-conventional-changelog": "^3.3.0",
"deepmerge": "^4.2.2",
"fs-extra": "^10.0.0",
"husky": "^4.3.0",
"jest": "^27.0.6",
"lint-staged": "^10.4.0",
"postcss": "^8.0.0",
"postcss-loader": "^5.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/fes-compiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"access": "public"
},
"dependencies": {
"@babel/preset-env": "^7.12.13",
"@babel/register": "^7.12.13",
"@babel/preset-env": "^7.15.0",
"@babel/register": "^7.15.3",
"@fesjs/utils": "^2.0.0",
"commander": "^7.0.0",
"dotenv": "8.2.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/fes-compiler/src/service/utils/pluginUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import {
import { PluginType } from '../enums';

const RE = {
[PluginType.plugin]: /^(@fesjs\/|@webank\/fes-|fes-)?plugin-/,
[PluginType.preset]: /^(@fesjs\/|@webank\/fes-|fes-)?preset-/
[PluginType.plugin]: /^(@fesjs\/|@webank\/fes-|fes-)plugin-/,
[PluginType.preset]: /^(@fesjs\/|@webank\/fes-|fes-)preset-/
};

export function isPluginOrPreset(type, name) {
Expand Down
5 changes: 5 additions & 0 deletions packages/fes-plugin-request/__tests__/request.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@


test('button disabled', async () => {
expect(1).toBe(1);
});
1 change: 0 additions & 1 deletion packages/fes-preset-built-in/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
"core-js": "^3.8.3",
"css-loader": "^5.0.1",
"css-minimizer-webpack-plugin": "^3.0.0",
"deepmerge": "^4.2.2",
"envinfo": "^7.7.3",
"file-loader": "^6.2.0",
"html-webpack-plugin": "^5.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// 根据 entry 进行代码块拆分
// 根据 entry 将文件输出到不同的文件夹

import deepmerge from 'deepmerge';
import { deepmerge } from '@fesjs/utils';

function createRules({
isDev,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const DEFAULT_EXCLUDE_NODE_MODULES = [
'core-js',
'echarts',
'@babel/runtime',
'lodash',
'lodash-es',
'webpack-dev-server',
'ansi-html',
'html-entities'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import deepmerge from 'deepmerge';
import { deepmerge } from '@fesjs/utils';

const defaultTerserOptions = {
compress: {
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1099,10 +1099,10 @@
"@babel/types" "^7.4.4"
esutils "^2.0.2"

"@babel/register@^7.12.13":
version "7.14.5"
resolved "https://registry.npmjs.org/@babel/register/-/register-7.14.5.tgz#d0eac615065d9c2f1995842f85d6e56c345f3233"
integrity sha512-TjJpGz/aDjFGWsItRBQMOFTrmTI9tr79CHOK+KIvLeCkbxuOAk2M5QHjvruIMGoo9OuccMh5euplPzc5FjAKGg==
"@babel/register@^7.15.3":
version "7.15.3"
resolved "https://registry.npmjs.org/@babel/register/-/register-7.15.3.tgz#6b40a549e06ec06c885b2ec42c3dd711f55fe752"
integrity sha512-mj4IY1ZJkorClxKTImccn4T81+UKTo4Ux0+OFSV9hME1ooqS9UV+pJ6BjD0qXPK4T3XW/KNa79XByjeEMZz+fw==
dependencies:
clone-deep "^4.0.1"
find-cache-dir "^2.0.0"
Expand Down

0 comments on commit 876cac7

Please sign in to comment.