Skip to content

Commit

Permalink
fix: setup correct utils inside asymmetric matchers (#2768)
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed Jan 30, 2023
1 parent 439c243 commit 415c8a9
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions 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
Expand All @@ -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
Expand Down

0 comments on commit 415c8a9

Please sign in to comment.