diff --git a/packages/global.d.ts b/packages/global.d.ts index 1bae0b929..79b551713 100644 --- a/packages/global.d.ts +++ b/packages/global.d.ts @@ -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 { - toHaveBeenWarned(): R - toHaveBeenWarnedLast(): R - toHaveBeenWarnedTimes(n: number): R - } -} - declare module '*.vue' {} declare module 'file-saver' { diff --git a/scripts/setup-vitest.ts b/scripts/setup-vitest.ts index 53e7f5fff..08203572a 100644 --- a/scripts/setup-vitest.ts +++ b/scripts/setup-vitest.ts @@ -1,5 +1,16 @@ import type { MockInstance } from 'vitest' +declare module 'vitest' { + interface Assertion extends CustomMatchers {} + interface AsymmetricMatchersContaining extends CustomMatchers {} +} + +interface CustomMatchers { + toHaveBeenWarned(): R + toHaveBeenWarnedLast(): R + toHaveBeenWarnedTimes(n: number): R +} + vi.stubGlobal('MathMLElement', class MathMLElement {}) expect.extend({