highlightjs / highlightjs/vue-plugin
How to use hljsVuePlugin in unit test w/ jest + @testing-library/vue ?
- Dominant language
- TypeScript
- Stars
- 241
- Forks
- 29
- PR merge metrics
- No merged PRs in 30d
Description
I am currently experienced the following error when running my unit tests:
` ReferenceError: Vue is not defined
`
```
> 10 | import hljsVuePlugin from '@highlightjs/vue-plugin';
| ^
```
Here is my component code:
```
import { defineComponent } from 'vue';
import hljsVuePlugin from '@highlightjs/vue-plugin';
export default defineComponent({
components: {
highlightjs: hljsVuePlugin.component,
},
});
```
in my test file, I'm simply trying to mount this component:
```
const wrapper = mount(FooBlah, {
global: {
stubs: {
highlightjs: {
template: '
},
},
},
});
```
Here are my libraries versions:
```
"vue": "^3.2.33",
"@highlightjs/vue-plugin": "^2.1.2",
"highlight.js": "^11.6.0",
"@vue/cli-plugin-unit-jest": "~5.0.4",
"@vue/test-utils": "^2.0.2",
"@vue/vue3-jest": "^27.0.0",
```
Is there any way I could tell him to simply ignore the `highlightjs` the component in the `jest.config` ?
Contributor guide
Assessment
This issue has not been assessed yet.