-
Notifications
You must be signed in to change notification settings - Fork 545
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VueTestUtils 2 API proposal for Vue 3 #161
Conversation
d40e80b
to
d26461c
Compare
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
sync
mode removed. All mutation methods returnnextTick
, you mustawait
them.find
is now split intofind
andfindComponent
.shallowMount
stubs defaults slotssetProps
only works for the mounted component.Note: The API for VueTestUtils 1.x will stay the same and will support Vue 2.x.
Rendered