@@ -24,30 +24,31 @@ npm install --save-dev vue-testing-library
24
24
babel-plugin-transform-runtime
25
25
```
26
26
27
- ```
27
+ ``` json
28
28
// package.json
29
- "scripts": {
30
- "test": "jest"
31
- }
29
+ "scripts" : {
30
+ "test" : " jest"
31
+ }
32
32
33
- "jest": {
34
- "moduleDirectories": [
35
- "node_modules",
36
- "src"
37
- ],
38
- "moduleFileExtensions": [
39
- "js",
40
- "vue"
41
- ],
42
- "testPathIgnorePatterns": [
43
- "/node_modules/"
44
- ],
45
- "transform": {
46
- "^.+\\.js$": "<rootDir>/node_modules/babel-jest",
47
- ".*\\.(vue)$": "<rootDir>/node_modules/vue-jest"
48
- }
33
+ "jest" : {
34
+ "moduleDirectories" : [
35
+ " node_modules" ,
36
+ " src"
37
+ ],
38
+ "moduleFileExtensions" : [
39
+ " js" ,
40
+ " vue"
41
+ ],
42
+ "testPathIgnorePatterns" : [
43
+ " /node_modules/"
44
+ ],
45
+ "transform" : {
46
+ "^.+\\ .js$" : " <rootDir>/node_modules/babel-jest" ,
47
+ ".*\\ .(vue)$" : " <rootDir>/node_modules/vue-jest"
49
48
}
50
-
49
+ }
50
+ ```
51
+ ```
51
52
// .babelrc
52
53
{
53
54
"presets": [
@@ -67,14 +68,16 @@ npm install --save-dev vue-testing-library
67
68
}
68
69
}
69
70
}
70
-
71
+ ```
72
+ ``` html
71
73
// src/TestComponent.vue
72
74
<template >
73
75
<div >
74
76
<span data-testid =" test1" >Hello World</span >
75
77
</div >
76
78
</template >
77
-
79
+ ```
80
+ ``` js
78
81
// src/TestComponent.spec.js
79
82
import ' jest-dom/extend-expect'
80
83
import { render } from ' vue-testing-library'
@@ -99,9 +102,9 @@ helper methods
99
102
2 . RenderOptions - an object containing additional information to be passed to
100
103
@vue/test-utils mount. This can include:
101
104
102
- - store - The object definition of a Vuex store, if present ` render ` will
105
+ - store - The object definition of a Vuex store. If present, ` render ` will
103
106
configure a Vuex store and pass to mount.
104
- - routes - A set of routes, if present render will configure VueRouter and pass
107
+ - routes - A set of routes. If present, render will configure VueRouter and pass
105
108
to mount.
106
109
107
110
All additional render options are passed to the vue-test-utils mount function
@@ -119,16 +122,16 @@ In particular, the `wait` utility can be very important in Vue components,
119
122
@vue/test-utils has succeeded in making the majority of updates happen
120
123
synchronously however there are occasions when wait will allow the DOM to
121
124
update. For example, see
122
- [ ` here ` ] ( https://github.com/dfcook /vue-testing-library/tree/master/tests/__tests__/validate-plugin .js ) .
125
+ [ ` here ` ] ( https://github.com/testing-library /vue-testing-library/tree/master/tests/__tests__/end-to-end .js ) .
123
126
124
127
## Examples
125
128
126
129
You'll find examples of testing with different libraries in
127
- [ the test directory] ( https://github.com/dfcook /vue-testing-library/tree/master/tests/__tests__ ) .
130
+ [ the test directory] ( https://github.com/testing-library /vue-testing-library/tree/master/tests/__tests__ ) .
128
131
Some included are:
129
132
130
- - [ ` vuex ` ] ( https://github.com/dfcook /vue-testing-library/tree /master/tests/__tests__/vuex.js )
131
- - [ ` vue-router ` ] ( https://github.com/dfcook /vue-testing-library/tree/master/tests/__tests__/vue-router.js )
132
- - [ ` vee-validate ` ] ( https://github.com/dfcook /vue-testing-library/tree/master/tests/__tests__/validate-plugin.js )
133
+ - [ ` vuex ` ] ( https://github.com/testing-library /vue-testing-library/blob /master/tests/__tests__/vuex.js )
134
+ - [ ` vue-router ` ] ( https://github.com/testing-library /vue-testing-library/tree/master/tests/__tests__/vue-router.js )
135
+ - [ ` vee-validate ` ] ( https://github.com/testing-library /vue-testing-library/tree/master/tests/__tests__/validate-plugin.js )
133
136
134
- [ gh ] : https://github.com/dfcook /vue-testing-library
137
+ [ gh ] : https://github.com/testing-library /vue-testing-library
0 commit comments