diff --git a/.eslintrc.js b/.eslintrc.js index 7813edc9..4b7aabb3 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -18,9 +18,7 @@ module.exports = { 'no-undefined': 'off', 'vue/valid-template-root': 'off' }, - parserOptions: { - babelOptions: { - presets: ['@babel/preset-env'] - } + env: { + jest: true } }; diff --git a/babel.config.js b/babel.config.js deleted file mode 100644 index 6a7918b6..00000000 --- a/babel.config.js +++ /dev/null @@ -1,6 +0,0 @@ -// for jest -module.exports = { - presets: [ - ['@babel/preset-env', { targets: { node: 'current' } }] - ] -}; diff --git a/jest.config.js b/jest.config.js index 3ab4408c..aae83a41 100644 --- a/jest.config.js +++ b/jest.config.js @@ -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' ] }; diff --git a/package.json b/package.json index 9283ef24..05022aa0 100644 --- a/package.json +++ b/package.json @@ -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", @@ -35,11 +35,12 @@ "@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", @@ -47,7 +48,6 @@ "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", diff --git a/packages/fes-compiler/package.json b/packages/fes-compiler/package.json index 3a734192..fdf03cd4 100644 --- a/packages/fes-compiler/package.json +++ b/packages/fes-compiler/package.json @@ -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", diff --git a/packages/fes-compiler/src/service/utils/pluginUtils.js b/packages/fes-compiler/src/service/utils/pluginUtils.js index 0cec2a80..8259a1f0 100644 --- a/packages/fes-compiler/src/service/utils/pluginUtils.js +++ b/packages/fes-compiler/src/service/utils/pluginUtils.js @@ -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) { diff --git a/packages/fes-plugin-request/__tests__/request.js b/packages/fes-plugin-request/__tests__/request.js index e69de29b..a0a204d4 100644 --- a/packages/fes-plugin-request/__tests__/request.js +++ b/packages/fes-plugin-request/__tests__/request.js @@ -0,0 +1,5 @@ + + +test('button disabled', async () => { + expect(1).toBe(1); +}); diff --git a/packages/fes-preset-built-in/package.json b/packages/fes-preset-built-in/package.json index ad4f1852..378eadfc 100644 --- a/packages/fes-preset-built-in/package.json +++ b/packages/fes-preset-built-in/package.json @@ -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", diff --git a/packages/fes-preset-built-in/src/plugins/commands/webpackConfig/css.js b/packages/fes-preset-built-in/src/plugins/commands/webpackConfig/css.js index 2a8da0e3..e09cba79 100644 --- a/packages/fes-preset-built-in/src/plugins/commands/webpackConfig/css.js +++ b/packages/fes-preset-built-in/src/plugins/commands/webpackConfig/css.js @@ -9,7 +9,7 @@ // 根据 entry 进行代码块拆分 // 根据 entry 将文件输出到不同的文件夹 -import deepmerge from 'deepmerge'; +import { deepmerge } from '@fesjs/utils'; function createRules({ isDev, diff --git a/packages/fes-preset-built-in/src/plugins/commands/webpackConfig/index.js b/packages/fes-preset-built-in/src/plugins/commands/webpackConfig/index.js index 9c387777..2c6795a9 100644 --- a/packages/fes-preset-built-in/src/plugins/commands/webpackConfig/index.js +++ b/packages/fes-preset-built-in/src/plugins/commands/webpackConfig/index.js @@ -36,7 +36,7 @@ const DEFAULT_EXCLUDE_NODE_MODULES = [ 'core-js', 'echarts', '@babel/runtime', - 'lodash', + 'lodash-es', 'webpack-dev-server', 'ansi-html', 'html-entities' diff --git a/packages/fes-preset-built-in/src/plugins/commands/webpackConfig/minimizer.js b/packages/fes-preset-built-in/src/plugins/commands/webpackConfig/minimizer.js index 308fe01d..c64e013c 100644 --- a/packages/fes-preset-built-in/src/plugins/commands/webpackConfig/minimizer.js +++ b/packages/fes-preset-built-in/src/plugins/commands/webpackConfig/minimizer.js @@ -1,4 +1,4 @@ -import deepmerge from 'deepmerge'; +import { deepmerge } from '@fesjs/utils'; const defaultTerserOptions = { compress: { diff --git a/yarn.lock b/yarn.lock index 4b0da3a2..9ae152ce 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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"