Skip to content

Commit

Permalink
fix(types): augment jest matchers (#665)
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed Feb 3, 2022
1 parent ce68e2b commit 6565492
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/vitest/src/index.ts
Expand Up @@ -41,6 +41,12 @@ type Promisify<O> = {
}

declare global {
// support augmenting jest.Matchers by other libraries
namespace jest {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
interface Matchers<R, T = {}> {}
}

namespace Vi {
interface ExpectStatic extends Chai.ExpectStatic, AsymmetricMatchersContaining {
<T>(actual: T, message?: string): Vi.Assertion<T>
Expand All @@ -56,7 +62,7 @@ declare global {
not: AsymmetricMatchersContaining
}

interface JestAssertion<T = any> {
interface JestAssertion<T = any> extends jest.Matchers<void, T> {
// Snapshot
toMatchSnapshot<U extends { [P in keyof T]: any }>(snapshot: Partial<U>, message?: string): void
toMatchSnapshot(message?: string): void
Expand Down

0 comments on commit 6565492

Please sign in to comment.