Wrapper from vue-test-utils not exposed?
See original GitHub issueHi, I wanted to call something like wrapper.isVueInstance()
like I would with vue-test-utils
. Looks like this wouldnāt be possible in this library? Thanks.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
API Reference - Vue Test Utils
Creates a Wrapper that contains the mounted and rendered Vue component to test. ... Details: mount is the main method exposed by Vue...
Read more >Wrapper | Vue Test Utils
A Wrapper is an object that contains a mounted component or vnode and methods to test the component or vnode.
Read more >Reusability & Composition - Vue Test Utils
Vue offers a way to pass props to all child components with provide and inject . The best way to test this behavior...
Read more >vue.js - Jest unit test cannot find component functions when ...
Jest unit test cannot find component functions when using Vue3 script setup syntax (wrapper.vm property does not exist on type).
Read more >Unit testing Vue components - DEV Community ā ā
If you're trying with VueJS v3, this post would not be helpful. ... import {mount} from "@vue/test-utils" // Normally a component to beĀ ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi! š and thanks for your question.
Vue Testing Library tries to follow the Testing Library Guiding Principle. Since we are trying to focus on rendering components instead of dealing with component instances, it wouldnāt make much sense to provide a tool that helps testing you the exact opposite - if a given wrapper is a Vue instance.
Thatās the reason behind not providing such method.
In Vue Testing Library world, Iād just render the component and assert that the āinitial stateā is already there - the default strings, values, and so on.
Hope I helped!
VTL exposes a
render()
method that contains DOM Testing Library queries + some vue-test-utils methods too: https://testing-library.com/docs/vue-testing-library/api So, in theory, you are mixing both libraris.The idea is that by using VTL you get the tools to test your components far from implementation details, so if you feel the urge to use a non-exposed method, I believe youāll find an available one that suits your needs. If not, let us know! š
Thanks for your questions! Feel free to open up another issue if anything is unclear while using VTL š