question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to use hljsVuePlugin in unit test w/ vitest + @testing-library/vue ?

See original GitHub issue

Describe 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: image

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:closed
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
joshgoebelcommented, Jun 29, 2022

2.1.1 published.

1reaction
joshgoebelcommented, Jun 29, 2022

Sorry for delay. Just tried this now but npm is being stupid… denied my OTP and now it’s refusing to publish with npm ERR! Cannot convert undefined or null to object… I’ll circle back tomorrow and see if I have better luck.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found