unplugin-vue-components icon indicating copy to clipboard operation
unplugin-vue-components copied to clipboard

How to work with vue-jest?

Open ErikCH opened this issue 3 years ago • 1 comments

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.

ErikCH avatar Jun 23 '22 20:06 ErikCH

But this will need you to keep the list of components updated in that file, making it more difficult to maintain.

JJBocanegra avatar Aug 17 '22 21:08 JJBocanegra

That's why he said it's not ideal solution

AndrewBogdanovTSS avatar Oct 27 '22 08:10 AndrewBogdanovTSS