2023-09-19 21:26:15 +00:00
|
|
|
import { consola } from 'consola'
|
|
|
|
import { vi } from 'vitest'
|
|
|
|
import { logger } from '../packages/kit'
|
|
|
|
|
|
|
|
consola.mockTypes(() => vi.fn())
|
|
|
|
logger.mockTypes(() => vi.fn())
|
|
|
|
|
|
|
|
const _warn = console.warn.bind(console)
|
|
|
|
|
|
|
|
const hiddenWarns = [
|
|
|
|
'[@vue/reactivity-transform]',
|
|
|
|
'[Vue warn]: Component',
|
2024-04-05 18:08:32 +00:00
|
|
|
'[Vue router warn]',
|
2023-09-19 21:26:15 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
console.warn = (arg0: any, ...args: any[]) => {
|
|
|
|
if ((typeof arg0 === 'string') && hiddenWarns.some(w => arg0.includes(w))) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
_warn(...args)
|
|
|
|
}
|
|
|
|
|
|
|
|
// for (const t of ['uncaughtException', 'unhandledRejection'] as const) {
|
|
|
|
// process.on(t, (err) => {
|
|
|
|
// console.error(`[nuxt test suite] [${t}]`, err)
|
|
|
|
// })
|
|
|
|
// }
|