chore: move custom matcher types to setup-vitest.ts (#11252)

This commit is contained in:
Tycho 2024-06-29 22:26:30 +08:00 committed by GitHub
parent 2f11a455e0
commit ae97e50538
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 9 deletions

View File

@ -19,15 +19,6 @@ declare var __FEATURE_PROD_DEVTOOLS__: boolean
declare var __FEATURE_SUSPENSE__: boolean
declare var __FEATURE_PROD_HYDRATION_MISMATCH_DETAILS__: boolean
// for tests
declare namespace jest {
interface Matchers<R, T> {
toHaveBeenWarned(): R
toHaveBeenWarnedLast(): R
toHaveBeenWarnedTimes(n: number): R
}
}
declare module '*.vue' {}
declare module 'file-saver' {

View File

@ -1,5 +1,16 @@
import type { MockInstance } from 'vitest'
declare module 'vitest' {
interface Assertion<T = any> extends CustomMatchers<T> {}
interface AsymmetricMatchersContaining extends CustomMatchers {}
}
interface CustomMatchers<R = unknown> {
toHaveBeenWarned(): R
toHaveBeenWarnedLast(): R
toHaveBeenWarnedTimes(n: number): R
}
vi.stubGlobal('MathMLElement', class MathMLElement {})
expect.extend({