mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 13:45:18 +00:00
28 lines
653 B
TypeScript
28 lines
653 B
TypeScript
|
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',
|
||
|
'[Vue router warn]'
|
||
|
]
|
||
|
|
||
|
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)
|
||
|
// })
|
||
|
// }
|