Skip to content

Commit 974aa25

Browse files
authored
docs: add section on stubbing components to common tips (#964)
1 parent 2c1bfb8 commit 974aa25

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Diff for: docs/guides/common-tips.md

+14
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,20 @@ mount(Component, {
132132
})
133133
```
134134

135+
### Stubbing components
136+
137+
You can override components that are registered globally or locally by using the `stubs` option:
138+
139+
```js
140+
import { mount } from '@vue/test-utils'
141+
142+
mount(Component, {
143+
// Will resolve globally-registered-component with
144+
// empty stub
145+
stubs: ['globally-registered-component']
146+
})
147+
```
148+
135149
### Dealing with Routing
136150

137151
Since routing by definition has to do with the overall structure of the application and involves multiple components, it is best tested via integration or end-to-end tests. For individual components that rely on `vue-router` features, you can mock them using the techniques mentioned above.

0 commit comments

Comments
 (0)