Docs are ported to VTU-next main repo: https://github.com/vuejs/vue-test-utils-next/
vuejs / test-utils-docs Goto Github PK
View Code? Open in Web Editor NEWDocs for vue-test-utils-next
Home Page: https://next.vue-test-utils.vuejs.org/
Docs for vue-test-utils-next
Home Page: https://next.vue-test-utils.vuejs.org/
Docs are ported to VTU-next main repo: https://github.com/vuejs/vue-test-utils-next/
router-link-stub
(source).One of the common frictions in VTU is how to test that given a prop, something happens in the component under testing.
We should explain:
created
or mounted
).This comment by @bencodezen in discord regarding docs-next:
Our goal in "Essentials" is to get people up and running with just enough and nothing more
Made me think about something that has been on my mind for days. Right now, I see VTU as a toolset with 2 categories of stuff:
find
, trigger
, setValue
, emitted
, and so on (I believe the list doesn't grow much larger, tbh).setProps
, findComponent
, and whatever flavour of shallow mounting we end up using.I think docs should follow this structure. An Essentials category, with everything you need to get up and running if you're writing your first tests with Vue.
Then, and only then, we unveil advanced features which require deeper knowledge.
Does it make sense? Would we be able to "split" all VTU-next features in two sets, or at least "prioritize" them in a way that allow us to teach them sequentially?
ref: vuejs/test-utils#255
Can we provide configuration guides for Jest+Mocha but then just use Jest for the rest of guide?
We're missing a section for the resurrected isVisible()
, showing how to test hidden content (using v-show
, for instance).
I believe handling forms is one of the main usages of Vue, and one of the common target of tests.
Thus, I would
vuelidate
(once they update to Vue 3)vee-validate
(once they update to Vue 3)We support config but we did not document it
I tried to set a Github Action to automatically build and deploy docs, but I lack the ability to set up Secrets in this repo. I guess we should wait until both repos are merged and then work from there?
Also it would be cool to leverage Netlify, just as docs-next is doing.
I'll keep updating manually for now ๐
Hi! ๐ I was writing docs for Making HTTP Requests, and I had this doubt.
There are several ways of mocking a module in Jest, and I'm not sure which one is the one we should showcase in docs:
jest.mock('axios')
axios.get = jest.fn().mockResolvedValue(posts)
jest.mock('axios', () => ({
get: jest.fn(() => posts)
}))
jest.mock('axios')
axios.get.mockResolvedValue(fakePostList)
any preference? any downsides?
disclaimer: docs will mention alternatives such as axios-mock-adapter
or msw
, but I want to keep it simple for the example.
I was thinking of adding a section somewhere with several tips on writing testable code:
Also, we could point to some smells:
Sounds cool? More ideas?
disclaimer: There's a lot of content on the internet about these topics. I think this section should be focused on Vue stuff with Vue examples, and then maybe links to well-established content.
https://vuejs.github.io/vue-test-utils-next-docs/
It's not very good. Let's put something here?
Alternatively we remove this page and redirect here: https://vuejs.github.io/vue-test-utils-next-docs/guide/introduction.html
What do you all think?
This is one of the common pain points when someone starts testing their apps.
Thus, I would
I'd use jest.mock
to perform the API mocking/stubbing
jest.mock
).I'm assuming Vuex 4, by the way.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.