How to use hljsVuePlugin in unit test w/ vitest + @testing-library/vue ?
See original GitHub issueDescribe the bug
Hi there 👋🏻 ,
I’m currently using this plugin in my Vue 3
+ vite
+ vitest
+ @testing-library/vue
project and I’m facing an issue when trying to run my test:
I’m not sure if the error comes from your library, but maybe from my code or from my test implementation. If this is the case I apologize in advance.
Could you help me to solve this problem?
Reproduction
I’ve created a repo with one test case:
- ❌ simple component using
highlightjs
component
I’m declaring hljsVuePlugin as a global.plugins
follwing what I’ve understood from @vue/test-utils
documentation but I do not know how to provide Vue instance 🤔
Repro repository : smarlhens/vue-vite-vitest-highlightjs-vue-plugin
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Getting Started with Vue and Vitest - This Dot Labs
This walk-through will assume that you have an understanding of how unit testing works, so lets dive in! What is Vitest? Vitest is...
Read more >Testing - Vue.js
Jest is a popular unit testing framework, and can be made to work with Vite via the vite-jest package. However, we only recommend...
Read more >Using Vue Test Utils in Vitest - YouTube
Testing Vue components is a crucial step to ensuring your frontend app is working as expected.While it's just as important to test all...
Read more >Unit Testing Vue 3 Component that uses Pinia with Vue ...
where I want to test that all the names of the contacts are displayed. My app uses Vitest and @testing-library/vue so in my...
Read more >Configure isCustomElement for unit tests · Issue #1865 - GitHub
Unable to config isCustomElement for unit tests. Steps to reproduce. I am using a web component library built with the Stencil framework. Some...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
2.1.1 published.
Sorry for delay. Just tried this now but npm is being stupid… denied my OTP and now it’s refusing to
publish
withnpm ERR! Cannot convert undefined or null to object
… I’ll circle back tomorrow and see if I have better luck.