question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wrapper from vue-test-utils not exposed?

See original GitHub issue

Hi, 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:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
afontcucommented, Jun 22, 2019

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!

0reactions
afontcucommented, Jun 25, 2019

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 šŸ˜„

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found