diff --git a/packages/expect/src/jest-utils.ts b/packages/expect/src/jest-utils.ts index 7fe4cc706534..3358ca39bed1 100644 --- a/packages/expect/src/jest-utils.ts +++ b/packages/expect/src/jest-utils.ts @@ -452,7 +452,7 @@ export function subsetEquality(object: unknown, subset: unknown, customTesters: return undefined return Object.keys(subset).every((key) => { - if (typeof subset[key] === 'object') { + if (subset[key] != null && typeof subset[key] === 'object') { if (seenReferences.has(subset[key])) return equals(object[key], subset[key], filteredCustomTesters)