From: Tycho Date: Sat, 29 Jun 2024 14:26:30 +0000 (+0800) Subject: chore: move custom matcher types to setup-vitest.ts (#11252) X-Git-Tag: v3.4.32~48 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ae97e5053895eeaaa443306e72cd8f45da001179;p=thirdparty%2Fvuejs%2Fcore.git chore: move custom matcher types to setup-vitest.ts (#11252) --- diff --git a/packages/global.d.ts b/packages/global.d.ts index 1bae0b929f..79b5517138 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 53e7f5fff5..08203572af 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({