Comments (5)
if the shallow render doesn't load child component Message.vue?
i try to use mount, but also hint error -- wrapper.hasProp() must be called on a Vue instance.
bcoz Message.vue is a functional component?
from vue-test-utils-mocha-webpack-example.
This package is using an old version of vue-test-utils. I'll look into it later today
from vue-test-utils-mocha-webpack-example.
Hello, I hvae a question:
At MessageToggle.vue, Message is a child component ,
I want to get its props by wrap.find , but it's not a Vue instance, can't use wrapper.props() with latest version vue-test-utils...
How can I do this?
const wrapper = shallow(MessageToggle)
const button = wrapper.find('#toggle-message')
const MessageComponent = wrapper.find(Message)
expect(MessageComponent.hasProp('msg', 'message')).toBe(true) _//can't get props for it's not vue instance_
If a component import any child component, should i test child?
It's still unit test?
from vue-test-utils-mocha-webpack-example.
This is only an issue for functional components. We changed how we treat functional components under the hood in the latest version, so it's not possible to check the props on a functional component. This is a bug that will be fixed in the next version 👍
You can still check child components in the way demonstrated in this repo for all other types of components
from vue-test-utils-mocha-webpack-example.
I've updated the code to use a non-functional component
from vue-test-utils-mocha-webpack-example.
Related Issues (11)
- broken link readme.md HOT 2
- Needs updated to use Vue CLI 3.0 and latest version of vue-test-utils HOT 1
- please update to recent vue-loader with vueloaderplugin HOT 3
- --watch mode stops reporting all test results on code/test updates HOT 1
- if you delete the package-lock.json and npm install tests do not work HOT 1
- Critical vulnerabilities in the setup HOT 1
- how run vue-test with mocha+pactjs?
- Missing `List.vue` file in coverage report HOT 4
- Code coverage in vue-test-utils-mocha-webpack-example only covers JavaScript not vue template file HOT 7
- vue-loader v15 requires VueLoaderPlugin in webpack config
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue-test-utils-mocha-webpack-example.