一个官方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.2
,render
函数并不支持第三个入参,我看6.4.2
就是最新的,为啥会跟官方的不一样呢?是官方的demo太老了,还是npm上版本太老了?