From b2720ab29d4338ebfd61f7962cf714804a8b32b3 Mon Sep 17 00:00:00 2001 From: "m.aliarslan" <86300262+Kewe63@users.noreply.github.com> Date: Sun, 13 Sep 2026 10:10:39 +0300 Subject: [PATCH] fix: honor skipCompare in hexEqual matcher --- tests/helpers/matchers/Hex.ts | 5 +++++ tests/helpers/matchers/index.test.ts | 1 + 2 files changed, 6 insertions(+) diff --git a/tests/helpers/matchers/Hex.ts b/tests/helpers/matchers/Hex.ts index 4e513da2..7f5c3125 100644 --- a/tests/helpers/matchers/Hex.ts +++ b/tests/helpers/matchers/Hex.ts @@ -15,6 +15,7 @@ // limitations under the License. import { isHex } from 'viem' +import { isSkipCompare } from './skippable' /** * Reference the implementation of hexEqual in hardhat-chai-matchers. @@ -29,6 +30,10 @@ export function supportHexEqual(Assertion: Chai.AssertionStatic, utils: Chai.Cha // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access const isNegated = (this as any).__flags.negate === true + if (isSkipCompare(other)) { + return + } + // check that both values are proper hex strings for (const element of [subject, other]) { if (!isHex(element)) { diff --git a/tests/helpers/matchers/index.test.ts b/tests/helpers/matchers/index.test.ts index a0c88fdd..77a969e4 100644 --- a/tests/helpers/matchers/index.test.ts +++ b/tests/helpers/matchers/index.test.ts @@ -101,6 +101,7 @@ describe('matchers', () => { describe('skippable ', () => { it('skip compare', () => { expect('0x3').to.eq(skipCompare) + expect('0x3').to.hexEqual(skipCompare) expect('0x4e59b44847b379578588920cA78FbF26c0B4956C').to.be.eq(skipCompare) expect({ a: '0x3', b: 4n }).to.be.deep.eq(skipCompare) })