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)
- chore(docs): translate the documentation to portuguese
- Bug: TypeError: $setup.mergeProps is not a function HOT 5
- Feature request: mount should accept a partial that describes local properties on component HOT 1
- Bug: Circular references in props cause "Maximum call stack size exceeded" since v2.4.5 HOT 7
- Bug: findComponent doesn't find anything when using @vue/compat HOT 4
- DOMWrapper giving different return than createWrapper. HOT 6
- .setValue to work on `[contenteditable=true]` elements HOT 3
- Bug: "to" is missing from the attribute in RouterLinkStub HOT 1
- Bug: isDeepRef causes "RangeError: Maximum call stack size exceeded" HOT 1
- Bug: Scoped slots always undefined when shallow mounting and `renderStubDefaultSlot` is enabled HOT 1
- Docs: afterEach in teleport section causes issues on happy-dom HOT 1
- dev: use eslint v9
- Bug: Event declared via $attrs in mount not establishing prop prefixed with `on` HOT 3
- Using useSlots will report a warning HOT 1
- Bug: Stubs broken in `[email protected]` HOT 4
- Bug: Maximum call stack size exceeded, only happen on version 2.4.5 HOT 1
- Bug: Transition - [Vue warn]: Wrong type passed as event handler to xxx - did you forget @ or : in front of your prop? HOT 6
- Bug: Need to preserve code of keydown event
- Bug: TypeScript errors with Vue generic components HOT 3
- Bug: stubbing not working in a Vue+TSX project HOT 3
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.