unplugin-vue-components
unplugin-vue-components copied to clipboard
How to work with vue-jest?
I have a vue 3 project that uses vue-jest. When I run the tests, I get an error that all the components are missing that are being auto-imported by unplugin.
I found a work around adding in a global parameter with all the components. (components is being imported from another object)
describe('Authenticator', () => {
it('Authenticator Exists', () => {
const wrapper = render(Authenticator, {
global: {
components,
},
});
expect(wrapper).toBeTruthy();
});
You can see this working here.
Is there an easier way of getting this working? Right now I cannot move to vitest.
But this will need you to keep the list of components updated in that file, making it more difficult to maintain.
That's why he said it's not ideal solution