From 6540546432e77618dac81c5405f0087190fecb55 Mon Sep 17 00:00:00 2001 From: jakub791 Date: Thu, 4 May 2023 13:15:36 +0200 Subject: [PATCH] fix augmentation of vitest Assertion interface The `Vi` namespace no longer exists since vitest 0.31.0. Using module augmentation is the new way. --- tests/utils.ts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/tests/utils.ts b/tests/utils.ts index a1e6084..afd6c67 100644 --- a/tests/utils.ts +++ b/tests/utils.ts @@ -1,18 +1,15 @@ import Decimal, { DecimalSource, format } from "util/bignum"; -import { expect } from "vitest"; +import { expect, Assertion } from "vitest"; interface CustomMatchers { compare_tolerance(expected: DecimalSource, tolerance?: number): R; } -declare global { - // eslint-disable-next-line @typescript-eslint/no-namespace - namespace Vi { - // eslint-disable-next-line @typescript-eslint/no-empty-interface - interface Assertion extends CustomMatchers {} - // eslint-disable-next-line @typescript-eslint/no-empty-interface - interface AsymmetricMatchersContaining extends CustomMatchers {} - } +declare module "vitest" { + // eslint-disable-next-line @typescript-eslint/no-empty-interface + interface Assertion extends CustomMatchers {} + // eslint-disable-next-line @typescript-eslint/no-empty-interface + interface AsymmetricMatchersContaining extends CustomMatchers {} } expect.extend({