har*_*ita 5 jestjs quasar-framework vuejs3
我试图在 vue3 中使用 jest 和 quasar 进行单元测试,但出现以下错误
\n失败测试/T1/views/xyz.spec.ts\n\xe2\x97\x8f 测试套件运行失败
\n类型错误:无法读取未定义的属性(读取“暗”)
\n我在类星体中使用深色和浅色模式来更改屏幕的背景颜色\n但出现错误dark
\n请帮助我
小智 0
我在 vuejs 3 + Quasar + vite 项目中使用 vitest 运行单元测试时遇到了这个错误。解决方案是将 Quasar 添加到global.plugins
测试套件的选项中
import { config, mount } from '@vue/test-utils';
import MyComponent from './../components/MyComponent.vue';
import { Quasar } from 'quasar';
config.global.plugins = [Quasar];
test('it renders'), () => {
const wrapper = mount(MyComponent);
};
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
628 次 |
最近记录: |