Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report] 测试用例无法引入使用了vant 的组件 #13093

Open
marsung opened this issue Aug 29, 2024 · 1 comment
Open

[Bug Report] 测试用例无法引入使用了vant 的组件 #13093

marsung opened this issue Aug 29, 2024 · 1 comment

Comments

@marsung
Copy link

marsung commented Aug 29, 2024

Reproduction Link

https://codesandbox.io/p/devbox/vant-4-issue-template-forked-w6qk8l?file=%2Fsrc%2Fcontr.test.ts

Vant Version

vant 4.9.4

Describe the Bug

Vue 3.0 + Vite + @vue/test-utils + Vitest

组件中使用了 vant(4.9.4),页面运行正常。但在做组件测试时,测试用例无法引入使用了vant 的组件.

Reproduce Steps

Vue 3.0 + Vite + @vue/test-utils + Vitest

组件中使用了 vant(4.9.4),页面运行正常。但在做组件测试时,测试用例无法引入使用了vant 的组件,代码如下:

import { mount } from '@vue/test-utils'
import { expect, test } from 'vitest'
import Controller from '../../views/controller.vue'

test('renders a play button', () => {
const wrapper = mount(Controller)
expect(wrapper.exists()).toBe(true);
})

报错如下:
FAIL tests/views/controller.test.ts [ tests/views/controller.test.ts ]
TypeError: Unknown file extension ".css" for E:...\node_modules.pnpm\[email protected][email protected][email protected]_\node_modules\vant\es\style\base.css

Device / Browser

VSCode + chorme

@zhaojjiang
Copy link
Contributor

麻烦补一下所示链接的使用步骤吧,包括如何进行测试,执行什么命令可以出现你的错误

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants