Skip to content

Commit 415c8a9

Browse files
authoredJan 30, 2023
fix: setup correct utils inside asymmetric matchers (#2768)
1 parent 439c243 commit 415c8a9

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed
 

‎packages/expect/src/jest-asymmetric-matchers.ts

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import type { ChaiPlugin, MatcherState } from './types'
22
import { GLOBAL_EXPECT } from './constants'
33
import { getState } from './state'
4-
import * as matcherUtils from './jest-matcher-utils'
4+
import { diff, getMatcherUtils, stringify } from './jest-matcher-utils'
55

6-
import { equals, isA } from './jest-utils'
6+
import { equals, isA, iterableEquality, subsetEquality } from './jest-utils'
77

88
export interface AsymmetricMatcherInterface {
99
asymmetricMatch(other: unknown): boolean
@@ -26,8 +26,14 @@ export abstract class AsymmetricMatcher<
2626
...getState(expect || (globalThis as any)[GLOBAL_EXPECT]),
2727
equals,
2828
isNot: this.inverse,
29-
utils: matcherUtils,
30-
} as any
29+
utils: {
30+
...getMatcherUtils(),
31+
diff,
32+
stringify,
33+
iterableEquality,
34+
subsetEquality,
35+
},
36+
}
3137
}
3238

3339
abstract asymmetricMatch(other: unknown): boolean

0 commit comments

Comments
 (0)
Please sign in to comment.