wot-design-uni/tests/suppress-warnings.ts
不如摸鱼去 7e84c5c91f
feat: 引入vitest做组件测试
* chore: 🚀 引入vitest做组件测试

* chore: 🚀 引入vitest做组件测试

* chore: 🚀 update workflow

* chore: 🚀 update workflow

* chore: 🚀 update workflow

* chore: 🚀 update workflow

* chore: 🚀 update nodejs version

* chore: 🚀 update nodejs version
2025-05-06 13:38:08 +08:00

21 lines
621 B
TypeScript

import { config } from '@vue/test-utils'
// 抑制 Vue 警告
const originalWarn = console.warn
console.warn = (...args: any[]) => {
// 过滤掉关于内置 HTML 元素的警告
if (args[0] && typeof args[0] === 'string' && args[0].includes('Do not use built-in or reserved HTML elements as component id')) {
return
}
originalWarn(...args)
}
// 告诉 Vue 这些是自定义元素
config.global.config = {
...config.global.config,
compilerOptions: {
...config.global.config?.compilerOptions,
isCustomElement: (tag) => ['view', 'text', 'image', 'input', 'textarea', 'video'].includes(tag)
}
}