Skip to content

Commit 2282bbe

Browse files
committed
chore: change test config, supprot jsx and ts
1 parent e60ceb6 commit 2282bbe

File tree

5 files changed

+108
-37
lines changed

5 files changed

+108
-37
lines changed

.babelrc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,9 @@
88
}
99
}]
1010
],
11-
"plugins": ["jsx-v-model", "transform-vue-jsx"]
11+
"plugins": [
12+
"jsx-v-model",
13+
"transform-vue-jsx",
14+
["@babel/plugin-proposal-decorators",{"legacy": true}]
15+
]
1216
}

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,12 @@
3232
],
3333
"license": "MIT",
3434
"dependencies": {
35+
"@babel/plugin-proposal-decorators": "^7.10.1",
36+
"ts-jest": "^26.1.0",
3537
"vue": "2.6.10",
3638
"vue-class-component": "^7.2.3"
3739
},
3840
"devDependencies": {
39-
"deepmerge": "^4.2.2",
40-
"ts-loader": "^7.0.5",
41-
"typescript": "^3.9.5",
4241
"@babel/core": "7.5.5",
4342
"@babel/preset-env": "7.5.5",
4443
"@vue/test-utils": "1.0.0-beta.29",
@@ -53,6 +52,7 @@
5352
"babel-preset-env": "^1.7.0",
5453
"copy-webpack-plugin": "5.0.4",
5554
"css-loader": "2.1.1",
55+
"deepmerge": "^4.2.2",
5656
"docsearch.js": "^2.6.3",
5757
"eslint": "5.16.0",
5858
"eslint-config-standard": "12.0.0",
@@ -81,6 +81,8 @@
8181
"stylus": "0.54.5",
8282
"stylus-loader": "3.0.2",
8383
"transliteration": "^2.1.8",
84+
"ts-loader": "^7.0.5",
85+
"typescript": "^3.9.5",
8486
"uglify-es": "3.3.9",
8587
"url-loader": "1.1.2",
8688
"vue-jest": "3.0.4",

packages/nTag/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Vue, { CreateElement } from 'vue'
1+
import Vue from 'vue'
22
import Component from 'vue-class-component'
33
import './index.scss';
44

@@ -13,7 +13,7 @@ const nTagProps = Vue.extend({
1313

1414
@Component
1515
export default class nTag extends nTagProps {
16-
render(h: CreateElement) {
16+
render() {
1717
return (
1818
<div class="n-tag">
1919
<div class={this.type}>

test/jest.config.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const path = require('path');
2+
const { defaults } = require('jest-config');
23

34
module.exports = {
45
rootDir: path.resolve(__dirname, '..'),
@@ -7,17 +8,15 @@ module.exports = {
78
'**/packages/**/*.vue'
89
],
910
coverageDirectory: '<rootDir>/test/coverage',
10-
moduleFileExtensions: [
11-
'js',
12-
'vue'
13-
],
11+
moduleFileExtensions: [...defaults.moduleFileExtensions, 'ts', 'tsx'],
1412
moduleNameMapper: {
1513
'^@/(.*)$': '<rootDir>/src/$1',
1614
'\\.(scss|sass|css)$': 'identity-obj-proxy'
1715
},
1816
transform: {
1917
'^.+\\.js$': 'babel-jest',
20-
'^.+\\.vue$': 'vue-jest'
18+
'^.+\\.vue$': 'vue-jest',
19+
'^.+\\.[jt]sx?$': 'babel-jest'
2120
},
2221
snapshotSerializers: [
2322
'<rootDir>/node_modules/jest-serializer-vue'

yarn.lock

Lines changed: 92 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,18 @@
7676
"@babel/helper-explode-assignable-expression" "^7.10.1"
7777
"@babel/types" "^7.10.1"
7878

79+
"@babel/helper-create-class-features-plugin@^7.10.1":
80+
version "7.10.2"
81+
resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.10.2.tgz#7474295770f217dbcf288bf7572eb213db46ee67"
82+
integrity sha512-5C/QhkGFh1vqcziq1vAL6SI9ymzUp8BCYjFpvYVhWP4DlATIb3u5q3iUd35mvlyGs8fO7hckkW7i0tmH+5+bvQ==
83+
dependencies:
84+
"@babel/helper-function-name" "^7.10.1"
85+
"@babel/helper-member-expression-to-functions" "^7.10.1"
86+
"@babel/helper-optimise-call-expression" "^7.10.1"
87+
"@babel/helper-plugin-utils" "^7.10.1"
88+
"@babel/helper-replace-supers" "^7.10.1"
89+
"@babel/helper-split-export-declaration" "^7.10.1"
90+
7991
"@babel/helper-create-regexp-features-plugin@^7.10.1", "@babel/helper-create-regexp-features-plugin@^7.8.3":
8092
version "7.10.1"
8193
resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.10.1.tgz#1b8feeab1594cbcfbf3ab5a3bbcabac0468efdbd"
@@ -254,6 +266,15 @@
254266
"@babel/helper-remap-async-to-generator" "^7.10.1"
255267
"@babel/plugin-syntax-async-generators" "^7.8.0"
256268

269+
"@babel/plugin-proposal-decorators@^7.10.1":
270+
version "7.10.1"
271+
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-decorators/-/plugin-proposal-decorators-7.10.1.tgz#9373c2d8db45345c6e30452ad77b469758e5c8f7"
272+
integrity sha512-xBfteh352MTke2U1NpclzMDmAmCdQ2fBZjhZQQfGTjXw6qcRYMkt528sA1U8o0ThDCSeuETXIj5bOGdxN+5gkw==
273+
dependencies:
274+
"@babel/helper-create-class-features-plugin" "^7.10.1"
275+
"@babel/helper-plugin-utils" "^7.10.1"
276+
"@babel/plugin-syntax-decorators" "^7.10.1"
277+
257278
"@babel/plugin-proposal-dynamic-import@^7.5.0":
258279
version "7.10.1"
259280
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.10.1.tgz#e36979dc1dc3b73f6d6816fc4951da2363488ef0"
@@ -302,6 +323,13 @@
302323
dependencies:
303324
"@babel/helper-plugin-utils" "^7.8.0"
304325

326+
"@babel/plugin-syntax-decorators@^7.10.1":
327+
version "7.10.1"
328+
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-decorators/-/plugin-syntax-decorators-7.10.1.tgz#16b869c4beafc9a442565147bda7ce0967bd4f13"
329+
integrity sha512-a9OAbQhKOwSle1Vr0NJu/ISg1sPfdEkfRKWpgPuzhnWWzForou2gIeUIIwjAMHRekhhpJ7eulZlYs0H14Cbi+g==
330+
dependencies:
331+
"@babel/helper-plugin-utils" "^7.10.1"
332+
305333
"@babel/plugin-syntax-dynamic-import@^7.2.0", "@babel/plugin-syntax-dynamic-import@^7.8.0":
306334
version "7.8.3"
307335
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz#62bf98b2da3cd21d626154fc96ee5b3cb68eacb3"
@@ -2265,14 +2293,21 @@ browserslist@^4.6.0, browserslist@^4.8.5:
22652293
node-releases "^1.1.53"
22662294
pkg-up "^2.0.0"
22672295

2296+
bs-logger@0.x:
2297+
version "0.2.6"
2298+
resolved "https://registry.yarnpkg.com/bs-logger/-/bs-logger-0.2.6.tgz#eb7d365307a72cf974cc6cda76b68354ad336bd8"
2299+
integrity sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==
2300+
dependencies:
2301+
fast-json-stable-stringify "2.x"
2302+
22682303
bser@2.1.1:
22692304
version "2.1.1"
22702305
resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.1.tgz#e6787da20ece9d07998533cfd9de6f5c38f4bc05"
22712306
integrity sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==
22722307
dependencies:
22732308
node-int64 "^0.4.0"
22742309

2275-
buffer-from@^1.0.0:
2310+
buffer-from@1.x, buffer-from@^1.0.0:
22762311
version "1.1.1"
22772312
resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef"
22782313
integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==
@@ -3943,7 +3978,7 @@ fast-deep-equal@^3.1.1:
39433978
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525"
39443979
integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==
39453980

3946-
fast-json-stable-stringify@^2.0.0:
3981+
fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0:
39473982
version "2.1.0"
39483983
resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633"
39493984
integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==
@@ -5820,6 +5855,13 @@ json3@^3.3.2:
58205855
resolved "https://registry.yarnpkg.com/json3/-/json3-3.3.3.tgz#7fc10e375fc5ae42c4705a5cc0aa6f62be305b81"
58215856
integrity sha512-c7/8mbUsKigAbLkD5B010BK4D9LZm7A1pNItkEwiUZRpIN66exu/e7YQWysGun+TRKaJp8MhemM+VkfWv42aCA==
58225857

5858+
json5@2.x, json5@^2.1.0, json5@^2.1.2:
5859+
version "2.1.3"
5860+
resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.3.tgz#c9b0f7fa9233bfe5807fe66fcf3a5617ed597d43"
5861+
integrity sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA==
5862+
dependencies:
5863+
minimist "^1.2.5"
5864+
58235865
json5@^0.5.0, json5@^0.5.1:
58245866
version "0.5.1"
58255867
resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821"
@@ -5832,13 +5874,6 @@ json5@^1.0.1:
58325874
dependencies:
58335875
minimist "^1.2.0"
58345876

5835-
json5@^2.1.0, json5@^2.1.2:
5836-
version "2.1.3"
5837-
resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.3.tgz#c9b0f7fa9233bfe5807fe66fcf3a5617ed597d43"
5838-
integrity sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA==
5839-
dependencies:
5840-
minimist "^1.2.5"
5841-
58425877
jsprim@^1.2.2:
58435878
version "1.4.1"
58445879
resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2"
@@ -6113,6 +6148,11 @@ lodash.clonedeep@^4.5.0:
61136148
resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef"
61146149
integrity sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=
61156150

6151+
lodash.memoize@4.x:
6152+
version "4.1.2"
6153+
resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe"
6154+
integrity sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=
6155+
61166156
lodash.sortby@^4.7.0:
61176157
version "4.7.0"
61186158
resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438"
@@ -6194,6 +6234,11 @@ make-dir@^2.0.0, make-dir@^2.1.0:
61946234
pify "^4.0.1"
61956235
semver "^5.6.0"
61966236

6237+
make-error@1.x:
6238+
version "1.3.6"
6239+
resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2"
6240+
integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==
6241+
61976242
makeerror@1.0.x:
61986243
version "1.0.11"
61996244
resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.11.tgz#e01a5c9109f2af79660e4e8b9587790184f5a96c"
@@ -6412,6 +6457,14 @@ methods@~1.1.2:
64126457
resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee"
64136458
integrity sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=
64146459

6460+
micromatch@4.x, micromatch@^4.0.0:
6461+
version "4.0.2"
6462+
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.2.tgz#4fcb0999bf9fbc2fcbdd212f6d629b9a56c39259"
6463+
integrity sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==
6464+
dependencies:
6465+
braces "^3.0.1"
6466+
picomatch "^2.0.5"
6467+
64156468
micromatch@^3.0.4, micromatch@^3.1.10, micromatch@^3.1.4, micromatch@^3.1.8:
64166469
version "3.1.10"
64176470
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23"
@@ -6431,14 +6484,6 @@ micromatch@^3.0.4, micromatch@^3.1.10, micromatch@^3.1.4, micromatch@^3.1.8:
64316484
snapdragon "^0.8.1"
64326485
to-regex "^3.0.2"
64336486

6434-
micromatch@^4.0.0:
6435-
version "4.0.2"
6436-
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.2.tgz#4fcb0999bf9fbc2fcbdd212f6d629b9a56c39259"
6437-
integrity sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==
6438-
dependencies:
6439-
braces "^3.0.1"
6440-
picomatch "^2.0.5"
6441-
64426487
miller-rabin@^4.0.0:
64436488
version "4.0.1"
64446489
resolved "https://registry.yarnpkg.com/miller-rabin/-/miller-rabin-4.0.1.tgz#f080351c865b0dc562a8462966daa53543c78a4d"
@@ -6553,7 +6598,7 @@ mkdirp@0.5.x, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1:
65536598
dependencies:
65546599
minimist "^1.2.5"
65556600

6556-
mkdirp@~1.0.3:
6601+
mkdirp@1.x, mkdirp@~1.0.3:
65576602
version "1.0.4"
65586603
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e"
65596604
integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==
@@ -8237,6 +8282,11 @@ semver@7.0.0:
82378282
resolved "https://registry.yarnpkg.com/semver/-/semver-7.0.0.tgz#5f3ca35761e47e05b206c6daff2cf814f0316b8e"
82388283
integrity sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==
82398284

8285+
semver@7.x:
8286+
version "7.3.2"
8287+
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.2.tgz#604962b052b81ed0786aae84389ffba70ffd3938"
8288+
integrity sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==
8289+
82408290
semver@^6.0.0, semver@^6.2.0, semver@^6.3.0:
82418291
version "6.3.0"
82428292
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d"
@@ -9108,6 +9158,22 @@ trim-newlines@^1.0.0:
91089158
dependencies:
91099159
glob "^7.1.2"
91109160

9161+
ts-jest@^26.1.0:
9162+
version "26.1.0"
9163+
resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-26.1.0.tgz#e9070fc97b3ea5557a48b67c631c74eb35e15417"
9164+
integrity sha512-JbhQdyDMYN5nfKXaAwCIyaWLGwevcT2/dbqRPsQeh6NZPUuXjZQZEfeLb75tz0ubCIgEELNm6xAzTe5NXs5Y4Q==
9165+
dependencies:
9166+
bs-logger "0.x"
9167+
buffer-from "1.x"
9168+
fast-json-stable-stringify "2.x"
9169+
json5 "2.x"
9170+
lodash.memoize "4.x"
9171+
make-error "1.x"
9172+
micromatch "4.x"
9173+
mkdirp "1.x"
9174+
semver "7.x"
9175+
yargs-parser "18.x"
9176+
91119177
ts-loader@^7.0.5:
91129178
version "7.0.5"
91139179
resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-7.0.5.tgz#789338fb01cb5dc0a33c54e50558b34a73c9c4c5"
@@ -9869,6 +9935,14 @@ yallist@^3.0.2:
98699935
resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd"
98709936
integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==
98719937

9938+
yargs-parser@18.x, yargs-parser@^18.1.1:
9939+
version "18.1.3"
9940+
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0"
9941+
integrity sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==
9942+
dependencies:
9943+
camelcase "^5.0.0"
9944+
decamelize "^1.2.0"
9945+
98729946
yargs-parser@5.0.0-security.0:
98739947
version "5.0.0-security.0"
98749948
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-5.0.0-security.0.tgz#4ff7271d25f90ac15643b86076a2ab499ec9ee24"
@@ -9893,14 +9967,6 @@ yargs-parser@^13.1.0, yargs-parser@^13.1.2:
98939967
camelcase "^5.0.0"
98949968
decamelize "^1.2.0"
98959969

9896-
yargs-parser@^18.1.1:
9897-
version "18.1.3"
9898-
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0"
9899-
integrity sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==
9900-
dependencies:
9901-
camelcase "^5.0.0"
9902-
decamelize "^1.2.0"
9903-
99049970
yargs@12.0.5:
99059971
version "12.0.5"
99069972
resolved "https://registry.yarnpkg.com/yargs/-/yargs-12.0.5.tgz#05f5997b609647b64f66b81e3b4b10a368e7ad13"

0 commit comments

Comments
 (0)