VueTestUtils 2 API proposal for Vue 3 #161
Conversation
active-rfcs/0000-vtu-api.md
Outdated
|
|
||
| [Link](https://vuejs.github.io/vue-test-utils-next-docs/api/#global-mocks) - Moved to `global.mocks` | ||
|
|
||
| #### provide |
While having everything affecting global things in global is perfect, thank you for this, I'm a bit concerned about provide. From what I understand We have two things in "global":
- things which are registered globally in real world application (components, directives, mixins, plugins)
- things which are VTU-specific but affect each component in the tree (stubs, mocks)
provide is just providing data for provide/inject, and for example providing foo in global.provide does not guarantee that my value will be always injected in component somewhere deep in the tree - it could be easily changed by provide in some ancestor
Maybe it's worth to keep this our of global object since its behavior is different?
|
This RFC is now in final comments stage. An RFC in final comments stage means that: The core team has reviewed the feedback and reached consensus about the general direction of the RFC and believe that this RFC is a worthwhile addition to the framework. |
|
I am in the process of upgrading to v1.0 and working through the deprecations within our application. Most everything that has been deprecated, I can use an alternative to achieve the same end, or rewrite to improve the test, which is great. |
|
@kspackman Sorry no-one replied to your comment. I also missed this. There is not really a great 1:1 migration path for that particular use case. The idea of separating You should still be able to chain |
|
I think we can merge this - most of these are not only implemented in VTU v2 now, but also back ported to v1 when they could be. |
|
@lmiller1990 yeah, we can merge this. I couldn't push to the branch so I will merge and rename the file locally |
|
Thanks! |


TLDR
VueTestUtils 2.x, which targets Vue 3, will introduce a few new methods and remove some less used ones. Usage should stay mostly the same.
syncmode removed. All mutation methods returnnextTick, you mustawaitthem.findis now split intofindandfindComponent.shallowMountstubs defaults slotssetPropsonly works for the mounted component.Note: The API for VueTestUtils 1.x will stay the same and will support Vue 2.x.
Rendered
The text was updated successfully, but these errors were encountered: