[Vue warn]: Failed to resolve component: a-descripttions
If this is a native custom element, make sure to exclude it from component resolution via compilerOptionns.isCustomElement
at <Index schemas= [


当我们测试组件中按需引入了第三方组件(ant-design-vue)时,单元测试会报Failed to resolve component

这里我们只需要在global中加入plugins: [antdv],相关代码如下:

import antdv from 'ant-design-vue';
describe('Descriptions', () => {
  test('renders properly', () => {
    const wrapper = mount(Descriptions, {
      props: {
        schemas: schemasList,
      },
      global: {
        plugins: [antdv], // 修改这里
      },
    });
    expect(wrapper.classes('cpn-basic-descriptions')).toBe(true);
  });
});