@jest/expect-utils 30.0.0-alpha.3 → 30.0.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,7 @@
1
1
  MIT License
2
2
 
3
3
  Copyright (c) Meta Platforms, Inc. and affiliates.
4
+ Copyright Contributors to the Jest project.
4
5
 
5
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
7
  of this software and associated documentation files (the "Software"), to deal
package/build/index.js CHANGED
@@ -530,7 +530,7 @@ const entries = obj => {
530
530
  return [...symbolProperties, ...Object.entries(obj)];
531
531
  };
532
532
  const isObject = a => a !== null && typeof a === 'object';
533
- const isObjectWithKeys = a => isObject(a) && !(a instanceof Error) && !Array.isArray(a) && !(a instanceof Date);
533
+ const isObjectWithKeys = a => isObject(a) && !(a instanceof Error) && !Array.isArray(a) && !(a instanceof Date) && !(a instanceof Set) && !(a instanceof Map);
534
534
  const subsetEquality = (object, subset, customTesters = []) => {
535
535
  const filteredCustomTesters = customTesters.filter(t => t !== subsetEquality);
536
536
 
@@ -541,12 +541,13 @@ const subsetEquality = (object, subset, customTesters = []) => {
541
541
  if (!isObjectWithKeys(subset)) {
542
542
  return undefined;
543
543
  }
544
- return getObjectKeys(subset).every(key => {
544
+ if (seenReferences.has(subset)) return undefined;
545
+ seenReferences.set(subset, true);
546
+ const matchResult = getObjectKeys(subset).every(key => {
545
547
  if (isObjectWithKeys(subset[key])) {
546
548
  if (seenReferences.has(subset[key])) {
547
549
  return (0, _jasmineUtils.equals)(object[key], subset[key], filteredCustomTesters);
548
550
  }
549
- seenReferences.set(subset[key], true);
550
551
  }
551
552
  const result = object != null && hasPropertyInObject(object, key) && (0, _jasmineUtils.equals)(object[key], subset[key], [...filteredCustomTesters, subsetEqualityWithContext(seenReferences)]);
552
553
  // The main goal of using seenReference is to avoid circular node on tree.
@@ -557,6 +558,8 @@ const subsetEquality = (object, subset, customTesters = []) => {
557
558
  seenReferences.delete(subset[key]);
558
559
  return result;
559
560
  });
561
+ seenReferences.delete(subset);
562
+ return matchResult;
560
563
  };
561
564
  return subsetEqualityWithContext()(object, subset);
562
565
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jest/expect-utils",
3
- "version": "30.0.0-alpha.3",
3
+ "version": "30.0.0-alpha.4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/jestjs/jest.git",
@@ -19,11 +19,11 @@
19
19
  "./package.json": "./package.json"
20
20
  },
21
21
  "dependencies": {
22
- "jest-get-type": "30.0.0-alpha.3"
22
+ "jest-get-type": "30.0.0-alpha.4"
23
23
  },
24
24
  "devDependencies": {
25
25
  "immutable": "^4.0.0",
26
- "jest-matcher-utils": "30.0.0-alpha.3"
26
+ "jest-matcher-utils": "30.0.0-alpha.4"
27
27
  },
28
28
  "engines": {
29
29
  "node": "^16.10.0 || ^18.12.0 || >=20.0.0"
@@ -31,5 +31,5 @@
31
31
  "publishConfig": {
32
32
  "access": "public"
33
33
  },
34
- "gitHead": "e267aff33d105399f2134bad7c8f82285104f3da"
34
+ "gitHead": "32b966f988d47a7673d2ef4b92e834dab7d66f07"
35
35
  }