我有很多vittest文件,我想注册的插件全球所有的测试文件。目前大多数的测试文件挂载VueWrapper
如下。
const wrapper = shallowMount(MyComponent, {
global: {
plugins: [i18n, MyCustomPlugin, [MyCustomLoggerPlugin, 'MyCustomParameter']],
},
props: {
},
})
字符串
有没有一种方法可以从mount函数中删除插件安装并全局执行此操作?I18n应该留在测试文件中,因为每个组件的本地化都不同。
1条答案
按热度按时间r6hnlfcb1#
通过创建一个vitetest.setup.ts
字符串
此文件必须在vite.tax.ts中注册。
型
更多信息可以在文档中找到。