fix augmentation of vitest Assertion interface

The `Vi` namespace no longer exists since vitest 0.31.0.
Using module augmentation is the new way.
This commit is contained in:
jakub791 2023-05-04 13:15:36 +02:00
parent cdc035b5bd
commit 6540546432

View file

@ -1,18 +1,15 @@
import Decimal, { DecimalSource, format } from "util/bignum";
import { expect } from "vitest";
import { expect, Assertion } from "vitest";
interface CustomMatchers<R = unknown> {
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({