vue3使用@testing-library/vue做组件测试,如何配置element-plus全局组件?

一个官方demo:https://github.com/testing-li...

里面使用render函数的第三个入参设置全局组件:

const {queryByText, getByText} = render(Translations, {}, vue => {
    // Let's register and configure Vuei18n normally
    vue.use(Vuei18n)

    const i18n = new Vuei18n({
      locale: 'en',
      fallbackLocale: 'en',
      messages,
    })

    // Notice how we return an object from the callback function. It will be
    // merged as an additional option on the created Vue instance.
    return {
      i18n,
    }
  })

而我安装的 @testing-library/vue@6.4.2render函数并不支持第三个入参,我看6.4.2就是最新的,为啥会跟官方的不一样呢?是官方的demo太老了,还是npm上版本太老了?

阅读 1.4k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题