From 415c8a93df3bc688cbc0b40238517ecded7354ed Mon Sep 17 00:00:00 2001 From: Vladimir Date: Mon, 30 Jan 2023 09:01:32 +0100 Subject: [PATCH] fix: setup correct utils inside asymmetric matchers (#2768) --- packages/expect/src/jest-asymmetric-matchers.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/expect/src/jest-asymmetric-matchers.ts b/packages/expect/src/jest-asymmetric-matchers.ts index 8f8f2cf32104..7e2c0c5d73b1 100644 --- a/packages/expect/src/jest-asymmetric-matchers.ts +++ b/packages/expect/src/jest-asymmetric-matchers.ts @@ -1,9 +1,9 @@ import type { ChaiPlugin, MatcherState } from './types' import { GLOBAL_EXPECT } from './constants' import { getState } from './state' -import * as matcherUtils from './jest-matcher-utils' +import { diff, getMatcherUtils, stringify } from './jest-matcher-utils' -import { equals, isA } from './jest-utils' +import { equals, isA, iterableEquality, subsetEquality } from './jest-utils' export interface AsymmetricMatcherInterface { asymmetricMatch(other: unknown): boolean @@ -26,8 +26,14 @@ export abstract class AsymmetricMatcher< ...getState(expect || (globalThis as any)[GLOBAL_EXPECT]), equals, isNot: this.inverse, - utils: matcherUtils, - } as any + utils: { + ...getMatcherUtils(), + diff, + stringify, + iterableEquality, + subsetEquality, + }, + } } abstract asymmetricMatch(other: unknown): boolean