Comments (8)
No worries, let's close then.
from test-utils.
hi @seahindeniz
Can you provide us a small repro online using https://stackblitz.com/github/vuejs/create-vue-templates/tree/main/typescript-vitest?file=src%2Fcomponents%2F__tests__%2FHelloWorld.spec.ts ?
It only takes a few minutes, and we'll be able to take a look
from test-utils.
Here it is @cexbrayat https://stackblitz.com/edit/github-yh3jfp?file=src%2Fcomponents%2F__tests__%2FTheWelcome.spec.ts
The src/components/__tests__/TheWelcome.spec.ts
file contains a snapshot of a compound component. When you run npm run test:unit
from another environment, you should get a failing test
from test-utils.
Here's a repo https://github.com/seahindeniz/github-yh3jfp to fetch it
from test-utils.
Thanks. Is there a reason to create a snapshot of the whole wrapper? Usually, you're only interested in wrapper.html()
for example
from test-utils.
Well, it's kind of arbitrary. Given the repro case, I have used an existing component that uses other components.
In my app, I have a single component that uses a small component to add icons. Then I have another component that uses Typography component to add texts with special styles. The need is basically arbitrary and the point is not on testing the wrapper.
Yeah, the html api could work but that means creating a custom functionality to create snapshots of a test and read to compare it with html to imitate the same thing.
from test-utils.
I'm sorry I don't understand your use case.
Yeah, the html api could work but that means creating a custom functionality to create snapshots of a test and read to compare it with html to imitate the same thing.
What do you mean by that? expect(wrapper.html()).toMatchSnapshot()
works out of the box.
In any case, snapshotting the entire wrapper is not a good idea: you get a lot of internal details, and there is no guarantee that this will not change in future VTU versions.
from test-utils.
🤦🏻♂️, That make sense a lot. I'm not sure where, but I must have read somewhere, and I get the impression of getting a snapshot of the whole component. Christ, what a waste of hours spend
from test-utils.
Related Issues (20)
- Does it work with "Vue 2.7.16"? HOT 2
- Bug: Unable to pass props of a unioned type to `mount` since 2.4.2 HOT 1
- Bug: Cannot acess global plugin in test file (wrapper.vm.$plugin) HOT 3
- Bug: findComponent doesn't work properly if child component is root of parent component HOT 2
- Bug: References to objects are lost when emitting events from child component HOT 2
- Feature request: respect devtools definition HOT 6
- Return type confusing, generics not working HOT 2
- Bug: no exported member 'PublicProps' HOT 4
- Bug: Submit event from form does not get caught in unit test HOT 3
- Bug: Errors during $setup are hidden and cause the template to be rendered with undefined properties HOT 6
- Bug: incompatibility with latest nuxt HOT 1
- Vue Warn, Error Handlers HOT 5
- Feature request: setSlots - Updates component slots HOT 2
- Bug: type inference for components is not on par with `defineComponent` HOT 1
- Bug: Props in child component defined in mixin are missing with `shallowMount` on @vue/compat HOT 2
- Bug: execute imports code in a component's children despite being stubbed HOT 2
- Feature request: update teleport testing documentation HOT 1
- Bug: wrapper.findComponent no longer working after upgrading to 2.4.2 HOT 6
- Bug: clicking button type submit doesn't trigger submit event HOT 2
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 test-utils.