This repository was archived by the owner on Nov 16, 2023. It is now read-only.
File tree 2 files changed +46
-1
lines changed
2 files changed +46
-1
lines changed Original file line number Diff line number Diff line change 6
6
"main" : " index.js" ,
7
7
"scripts" : {
8
8
"build" : " webpack" ,
9
- "test" : " echo \" Error: no test specified \" && exit 1 "
9
+ "test" : " jest "
10
10
},
11
11
"keywords" : [],
12
12
"author" : {
21
21
"vue-router" : " ^3.0.1"
22
22
},
23
23
"devDependencies" : {
24
+ "@types/jest" : " ^23.3.2" ,
25
+ "@vue/test-utils" : " ^1.0.0-beta.25" ,
24
26
"css-loader" : " ^0.28.1" ,
27
+ "jest" : " ^23.6.0" ,
28
+ "ts-jest" : " ^23.10.3" ,
25
29
"ts-loader" : " ^2.0.3" ,
26
30
"typescript" : " ^2.7.2" ,
31
+ "vue-jest" : " ^2.6.0" ,
27
32
"vue-loader" : " ^12.0.3" ,
28
33
"vue-template-compiler" : " ^2.5.2" ,
29
34
"webpack" : " ^2.5.0"
35
+ },
36
+ "jest" : {
37
+ "moduleFileExtensions" : [
38
+ " js" ,
39
+ " ts" ,
40
+ " vue"
41
+ ],
42
+ "modulePaths" : [
43
+ " <rootDir>/src" ,
44
+ " <rootDir>/node_modules"
45
+ ],
46
+ "transform" : {
47
+ ".*\\ .(vue)$" : " <rootDir>/node_modules/vue-jest" ,
48
+ ".*\\ .(ts)$" : " ts-jest"
49
+ },
50
+ "moduleNameMapper" : {
51
+ "^@/(.*)$" : " <rootDir>/src/$1"
52
+ },
53
+ "globals" : {
54
+ "vue-jest" : {
55
+ "tsConfigFile" : " tsconfig.json"
56
+ }
57
+ },
58
+ "testRegex" : " (/__tests__/.*|(\\ .|/)(test|spec))\\ .(jsx?|tsx?)$"
30
59
}
31
60
}
Original file line number Diff line number Diff line change
1
+ import Hello from '@/components/Hello.vue' ;
2
+ import { mount } from '@vue/test-utils' ;
3
+
4
+ describe ( 'Hello.vue' , ( ) => {
5
+ it ( 'should render' , ( ) => {
6
+ const name = 'World' ;
7
+ const initialEnthusiasm = 5 ;
8
+
9
+ const wrapper = mount ( Hello , {
10
+ propsData : {
11
+ name, initialEnthusiasm
12
+ }
13
+ } )
14
+ expect ( wrapper . find ( '.greeting' ) . text ( ) ) . toBe ( 'Hello World!!!!!' )
15
+ } )
16
+ } ) ;
You can’t perform that action at this time.
0 commit comments