From 64e83c7e58627ccade6e09832951a59b349f91ae Mon Sep 17 00:00:00 2001 From: seognil LC Date: Wed, 22 Jan 2020 14:00:09 +0800 Subject: [PATCH] improvement(jest): config --- testing/jest/babel.config.js | 16 +--- testing/jest/jest.config.js | 2 + testing/jest/package.json | 8 +- testing/jest/readme.md | 2 +- testing/jest/src/{ => test}/add.test.ts | 2 +- testing/jest/src/{ => test}/single.test.ts | 0 testing/jest/tsconfig.json | 9 +- testing/jest/yarn.lock | 105 ++------------------- 8 files changed, 19 insertions(+), 125 deletions(-) rename testing/jest/src/{ => test}/add.test.ts (69%) rename testing/jest/src/{ => test}/single.test.ts (100%) diff --git a/testing/jest/babel.config.js b/testing/jest/babel.config.js index 02f859e..825084d 100644 --- a/testing/jest/babel.config.js +++ b/testing/jest/babel.config.js @@ -1,17 +1,9 @@ -module.exports = { - plugins: [ - '@babel/plugin-syntax-dynamic-import', - - ['@babel/plugin-proposal-decorators', { legacy: true }], - ['@babel/plugin-proposal-class-properties', { loose: true }], - '@babel/plugin-proposal-nullish-coalescing-operator', - '@babel/plugin-proposal-optional-chaining', +// * ---------------- simply support esnext and ts - // ['@babel/plugin-transform-runtime', { corejs: 3 }], - ], +module.exports = { presets: [ - ['@babel/preset-env', { modules: 'commonjs' }], - '@babel/preset-react', + // + '@babel/preset-env', '@babel/preset-typescript', ], }; diff --git a/testing/jest/jest.config.js b/testing/jest/jest.config.js index 59e93f1..b7062a1 100644 --- a/testing/jest/jest.config.js +++ b/testing/jest/jest.config.js @@ -1,3 +1,5 @@ +// * ---------------- super simple config demo + module.exports = { verbose: true, collectCoverage: true, diff --git a/testing/jest/package.json b/testing/jest/package.json index 8e4a59b..d37f820 100644 --- a/testing/jest/package.json +++ b/testing/jest/package.json @@ -4,16 +4,10 @@ "test:watch": "jest -w" }, "devDependencies": { - "@babel/plugin-proposal-class-properties": "^7.8.3", - "@babel/plugin-proposal-decorators": "^7.8.3", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.8.3", - "@babel/plugin-proposal-optional-chaining": "^7.8.3", - "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-transform-runtime": "^7.8.3", "@babel/preset-env": "^7.8.3", - "@babel/preset-react": "^7.8.3", "@babel/preset-typescript": "^7.8.3", "@types/jest": "^24.9.0", + "@types/node": "^13.1.8", "jest": "^24.9.0" } } diff --git a/testing/jest/readme.md b/testing/jest/readme.md index 9c1de02..b528c49 100644 --- a/testing/jest/readme.md +++ b/testing/jest/readme.md @@ -12,4 +12,4 @@ npm run test:watch Check [Jest Doc](https://jestjs.io/docs/en/expect) -Try change test code in `*test.js` files \ No newline at end of file +Try to modify test files in `test` folder \ No newline at end of file diff --git a/testing/jest/src/add.test.ts b/testing/jest/src/test/add.test.ts similarity index 69% rename from testing/jest/src/add.test.ts rename to testing/jest/src/test/add.test.ts index 5dbc381..8818cd6 100644 --- a/testing/jest/src/add.test.ts +++ b/testing/jest/src/test/add.test.ts @@ -1,4 +1,4 @@ -import { add } from './add'; +import { add } from '../add'; test('test add function', () => { expect(add(1, 2)).toBe(3); diff --git a/testing/jest/src/single.test.ts b/testing/jest/src/test/single.test.ts similarity index 100% rename from testing/jest/src/single.test.ts rename to testing/jest/src/test/single.test.ts diff --git a/testing/jest/tsconfig.json b/testing/jest/tsconfig.json index 7356340..9e26dfe 100644 --- a/testing/jest/tsconfig.json +++ b/testing/jest/tsconfig.json @@ -1,8 +1 @@ -{ - "compilerOptions": { - "types": [ - "jest", - "node" - ] - } -} \ No newline at end of file +{} \ No newline at end of file diff --git a/testing/jest/yarn.lock b/testing/jest/yarn.lock index ba3d362..9a3bc92 100644 --- a/testing/jest/yarn.lock +++ b/testing/jest/yarn.lock @@ -64,14 +64,6 @@ "@babel/helper-explode-assignable-expression" "^7.8.3" "@babel/types" "^7.8.3" -"@babel/helper-builder-react-jsx@^7.8.3": - version "7.8.3" - resolved "https://registry.npm.taobao.org/@babel/helper-builder-react-jsx/download/@babel/helper-builder-react-jsx-7.8.3.tgz#dee98d7d79cc1f003d80b76fe01c7f8945665ff6" - integrity sha1-3umNfXnMHwA9gLdv4Bx/iUVmX/Y= - dependencies: - "@babel/types" "^7.8.3" - esutils "^2.0.0" - "@babel/helper-call-delegate@^7.8.3": version "7.8.3" resolved "https://registry.npm.taobao.org/@babel/helper-call-delegate/download/@babel/helper-call-delegate-7.8.3.tgz#de82619898aa605d409c42be6ffb8d7204579692" @@ -275,23 +267,6 @@ "@babel/helper-remap-async-to-generator" "^7.8.3" "@babel/plugin-syntax-async-generators" "^7.8.0" -"@babel/plugin-proposal-class-properties@^7.8.3": - version "7.8.3" - resolved "https://registry.npm.taobao.org/@babel/plugin-proposal-class-properties/download/@babel/plugin-proposal-class-properties-7.8.3.tgz#5e06654af5cd04b608915aada9b2a6788004464e" - integrity sha1-XgZlSvXNBLYIkVqtqbKmeIAERk4= - dependencies: - "@babel/helper-create-class-features-plugin" "^7.8.3" - "@babel/helper-plugin-utils" "^7.8.3" - -"@babel/plugin-proposal-decorators@^7.8.3": - version "7.8.3" - resolved "https://registry.npm.taobao.org/@babel/plugin-proposal-decorators/download/@babel/plugin-proposal-decorators-7.8.3.tgz#2156860ab65c5abf068c3f67042184041066543e" - integrity sha1-IVaGCrZcWr8GjD9nBCGEBBBmVD4= - dependencies: - "@babel/helper-create-class-features-plugin" "^7.8.3" - "@babel/helper-plugin-utils" "^7.8.3" - "@babel/plugin-syntax-decorators" "^7.8.3" - "@babel/plugin-proposal-dynamic-import@^7.8.3": version "7.8.3" resolved "https://registry.npm.taobao.org/@babel/plugin-proposal-dynamic-import/download/@babel/plugin-proposal-dynamic-import-7.8.3.tgz#38c4fe555744826e97e2ae930b0fb4cc07e66054" @@ -355,14 +330,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-decorators@^7.8.3": - version "7.8.3" - resolved "https://registry.npm.taobao.org/@babel/plugin-syntax-decorators/download/@babel/plugin-syntax-decorators-7.8.3.tgz#8d2c15a9f1af624b0025f961682a9d53d3001bda" - integrity sha1-jSwVqfGvYksAJflhaCqdU9MAG9o= - dependencies: - "@babel/helper-plugin-utils" "^7.8.3" - -"@babel/plugin-syntax-dynamic-import@^7.8.0", "@babel/plugin-syntax-dynamic-import@^7.8.3": +"@babel/plugin-syntax-dynamic-import@^7.8.0": version "7.8.3" resolved "https://registry.npm.taobao.org/@babel/plugin-syntax-dynamic-import/download/@babel/plugin-syntax-dynamic-import-7.8.3.tgz#62bf98b2da3cd21d626154fc96ee5b3cb68eacb3" integrity sha1-Yr+Ysto80h1iYVT8lu5bPLaOrLM= @@ -376,13 +344,6 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-jsx@^7.8.3": - version "7.8.3" - resolved "https://registry.npm.taobao.org/@babel/plugin-syntax-jsx/download/@babel/plugin-syntax-jsx-7.8.3.tgz#521b06c83c40480f1e58b4fd33b92eceb1d6ea94" - integrity sha1-UhsGyDxASA8eWLT9M7kuzrHW6pQ= - dependencies: - "@babel/helper-plugin-utils" "^7.8.3" - "@babel/plugin-syntax-nullish-coalescing-operator@^7.8.0": version "7.8.3" resolved "https://registry.npm.taobao.org/@babel/plugin-syntax-nullish-coalescing-operator/download/@babel/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz#167ed70368886081f74b5c36c65a88c03b66d1a9" @@ -611,38 +572,6 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-react-display-name@^7.8.3": - version "7.8.3" - resolved "https://registry.npm.taobao.org/@babel/plugin-transform-react-display-name/download/@babel/plugin-transform-react-display-name-7.8.3.tgz#70ded987c91609f78353dd76d2fb2a0bb991e8e5" - integrity sha1-cN7Zh8kWCfeDU9120vsqC7mR6OU= - dependencies: - "@babel/helper-plugin-utils" "^7.8.3" - -"@babel/plugin-transform-react-jsx-self@^7.8.3": - version "7.8.3" - resolved "https://registry.npm.taobao.org/@babel/plugin-transform-react-jsx-self/download/@babel/plugin-transform-react-jsx-self-7.8.3.tgz#c4f178b2aa588ecfa8d077ea80d4194ee77ed702" - integrity sha1-xPF4sqpYjs+o0HfqgNQZTud+1wI= - dependencies: - "@babel/helper-plugin-utils" "^7.8.3" - "@babel/plugin-syntax-jsx" "^7.8.3" - -"@babel/plugin-transform-react-jsx-source@^7.8.3": - version "7.8.3" - resolved "https://registry.npm.taobao.org/@babel/plugin-transform-react-jsx-source/download/@babel/plugin-transform-react-jsx-source-7.8.3.tgz#951e75a8af47f9f120db731be095d2b2c34920e0" - integrity sha1-lR51qK9H+fEg23Mb4JXSssNJIOA= - dependencies: - "@babel/helper-plugin-utils" "^7.8.3" - "@babel/plugin-syntax-jsx" "^7.8.3" - -"@babel/plugin-transform-react-jsx@^7.8.3": - version "7.8.3" - resolved "https://registry.npm.taobao.org/@babel/plugin-transform-react-jsx/download/@babel/plugin-transform-react-jsx-7.8.3.tgz#4220349c0390fdefa505365f68c103562ab2fc4a" - integrity sha1-QiA0nAOQ/e+lBTZfaMEDViqy/Eo= - dependencies: - "@babel/helper-builder-react-jsx" "^7.8.3" - "@babel/helper-plugin-utils" "^7.8.3" - "@babel/plugin-syntax-jsx" "^7.8.3" - "@babel/plugin-transform-regenerator@^7.8.3": version "7.8.3" resolved "https://registry.npm.taobao.org/@babel/plugin-transform-regenerator/download/@babel/plugin-transform-regenerator-7.8.3.tgz#b31031e8059c07495bf23614c97f3d9698bc6ec8" @@ -657,16 +586,6 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-runtime@^7.8.3": - version "7.8.3" - resolved "https://registry.npm.taobao.org/@babel/plugin-transform-runtime/download/@babel/plugin-transform-runtime-7.8.3.tgz#c0153bc0a5375ebc1f1591cb7eea223adea9f169" - integrity sha1-wBU7wKU3XrwfFZHLfuoiOt6p8Wk= - dependencies: - "@babel/helper-module-imports" "^7.8.3" - "@babel/helper-plugin-utils" "^7.8.3" - resolve "^1.8.1" - semver "^5.5.1" - "@babel/plugin-transform-shorthand-properties@^7.8.3": version "7.8.3" resolved "https://registry.npm.taobao.org/@babel/plugin-transform-shorthand-properties/download/@babel/plugin-transform-shorthand-properties-7.8.3.tgz#28545216e023a832d4d3a1185ed492bcfeac08c8" @@ -784,17 +703,6 @@ levenary "^1.1.0" semver "^5.5.0" -"@babel/preset-react@^7.8.3": - version "7.8.3" - resolved "https://registry.npm.taobao.org/@babel/preset-react/download/@babel/preset-react-7.8.3.tgz?cache=0&sync_timestamp=1578966819906&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fpreset-react%2Fdownload%2F%40babel%2Fpreset-react-7.8.3.tgz#23dc63f1b5b0751283e04252e78cf1d6589273d2" - integrity sha1-I9xj8bWwdRKD4EJS54zx1liSc9I= - dependencies: - "@babel/helper-plugin-utils" "^7.8.3" - "@babel/plugin-transform-react-display-name" "^7.8.3" - "@babel/plugin-transform-react-jsx" "^7.8.3" - "@babel/plugin-transform-react-jsx-self" "^7.8.3" - "@babel/plugin-transform-react-jsx-source" "^7.8.3" - "@babel/preset-typescript@^7.8.3": version "7.8.3" resolved "https://registry.npm.taobao.org/@babel/preset-typescript/download/@babel/preset-typescript-7.8.3.tgz#90af8690121beecd9a75d0cc26c6be39d1595d13" @@ -1052,6 +960,11 @@ dependencies: jest-diff "^24.3.0" +"@types/node@^13.1.8": + version "13.1.8" + resolved "https://registry.npm.taobao.org/@types/node/download/@types/node-13.1.8.tgz#1d590429fe8187a02707720ecf38a6fe46ce294b" + integrity sha1-HVkEKf6Bh6AnB3IOzzim/kbOKUs= + "@types/stack-utils@^1.0.1": version "1.0.1" resolved "https://registry.npm.taobao.org/@types/stack-utils/download/@types/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e" @@ -1689,7 +1602,7 @@ estraverse@^4.2.0: resolved "https://registry.npm.taobao.org/estraverse/download/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" integrity sha1-OYrT88WiSUi+dyXoPRGn3ijNvR0= -esutils@^2.0.0, esutils@^2.0.2: +esutils@^2.0.2: version "2.0.3" resolved "https://registry.npm.taobao.org/esutils/download/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" integrity sha1-dNLrTeC42hKTcRkQ1Qd1ubcQ72Q= @@ -3418,7 +3331,7 @@ resolve@1.1.7: resolved "https://registry.npm.taobao.org/resolve/download/resolve-1.1.7.tgz?cache=0&sync_timestamp=1578362210740&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fresolve%2Fdownload%2Fresolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" integrity sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs= -resolve@^1.10.0, resolve@^1.3.2, resolve@^1.8.1: +resolve@^1.10.0, resolve@^1.3.2: version "1.14.2" resolved "https://registry.npm.taobao.org/resolve/download/resolve-1.14.2.tgz?cache=0&sync_timestamp=1578362210740&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fresolve%2Fdownload%2Fresolve-1.14.2.tgz#dbf31d0fa98b1f29aa5169783b9c290cb865fea2" integrity sha1-2/MdD6mLHymqUWl4O5wpDLhl/qI= @@ -3484,7 +3397,7 @@ sax@^1.2.4: resolved "https://registry.npm.taobao.org/sax/download/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" integrity sha1-KBYjTiN4vdxOU1T6tcqold9xANk= -"semver@2 || 3 || 4 || 5", semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0: +"semver@2 || 3 || 4 || 5", semver@^5.4.1, semver@^5.5.0, semver@^5.6.0: version "5.7.1" resolved "https://registry.npm.taobao.org/semver/download/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha1-qVT5Ma66UI0we78Gnv8MAclhFvc=