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

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.
Files changed (2) hide show
  1. package/build/index.js +9 -8
  2. package/package.json +4 -6
package/build/index.js CHANGED
@@ -170,8 +170,8 @@ function eq(a, b, aStack, bStack, customTesters, strictCheck) {
170
170
  const testerContext = {
171
171
  equals
172
172
  };
173
- for (let i = 0; i < customTesters.length; i++) {
174
- const customTesterResult = customTesters[i].call(testerContext, a, b, customTesters);
173
+ for (const item of customTesters) {
174
+ const customTesterResult = item.call(testerContext, a, b, customTesters);
175
175
  if (customTesterResult !== undefined) {
176
176
  return customTesterResult;
177
177
  }
@@ -293,7 +293,7 @@ function keys(obj, hasKey) {
293
293
  keys.push(key);
294
294
  }
295
295
  }
296
- return keys.concat(Object.getOwnPropertySymbols(obj).filter(symbol => Object.getOwnPropertyDescriptor(obj, symbol).enumerable));
296
+ return [...keys, ...Object.getOwnPropertySymbols(obj).filter(symbol => Object.getOwnPropertyDescriptor(obj, symbol).enumerable)];
297
297
  }
298
298
  function hasKey(obj, key) {
299
299
  return Object.prototype.hasOwnProperty.call(obj, key);
@@ -526,10 +526,11 @@ aStack = [], bStack = []) => {
526
526
  exports.iterableEquality = iterableEquality;
527
527
  const entries = obj => {
528
528
  if (!isObject(obj)) return [];
529
- return Object.getOwnPropertySymbols(obj).filter(key => key !== Symbol.iterator).map(key => [key, obj[key]]).concat(Object.entries(obj));
529
+ const symbolProperties = Object.getOwnPropertySymbols(obj).filter(key => key !== Symbol.iterator).map(key => [key, obj[key]]);
530
+ return [...symbolProperties, ...Object.entries(obj)];
530
531
  };
531
532
  const isObject = a => a !== null && typeof a === 'object';
532
- const isObjectWithKeys = a => isObject(a) && !(a instanceof Error) && !(a instanceof Array) && !(a instanceof Date);
533
+ const isObjectWithKeys = a => isObject(a) && !(a instanceof Error) && !Array.isArray(a) && !(a instanceof Date);
533
534
  const subsetEquality = (object, subset, customTesters = []) => {
534
535
  const filteredCustomTesters = customTesters.filter(t => t !== subsetEquality);
535
536
 
@@ -624,13 +625,13 @@ const pathAsArray = propertyPath => {
624
625
  }
625
626
 
626
627
  // will match everything that's not a dot or a bracket, and "" for consecutive dots.
627
- const pattern = RegExp('[^.[\\]]+|(?=(?:\\.)(?:\\.|$))', 'g');
628
+ const pattern = new RegExp('[^.[\\]]+|(?=(?:\\.)(?:\\.|$))', 'g');
628
629
 
629
630
  // Because the regex won't match a dot in the beginning of the path, if present.
630
631
  if (propertyPath[0] === '.') {
631
632
  properties.push('');
632
633
  }
633
- propertyPath.replace(pattern, match => {
634
+ propertyPath.replaceAll(pattern, match => {
634
635
  properties.push(match);
635
636
  return match;
636
637
  });
@@ -653,7 +654,7 @@ exports.isError = isError;
653
654
  function emptyObject(obj) {
654
655
  return obj && typeof obj === 'object' ? Object.keys(obj).length === 0 : false;
655
656
  }
656
- const MULTILINE_REGEXP = /[\r\n]/;
657
+ const MULTILINE_REGEXP = /[\n\r]/;
657
658
  const isOneline = (expected, received) => typeof expected === 'string' && typeof received === 'string' && (!MULTILINE_REGEXP.test(expected) || !MULTILINE_REGEXP.test(received));
658
659
  exports.isOneline = isOneline;
659
660
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jest/expect-utils",
3
- "version": "30.0.0-alpha.2",
3
+ "version": "30.0.0-alpha.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/jestjs/jest.git",
@@ -19,13 +19,11 @@
19
19
  "./package.json": "./package.json"
20
20
  },
21
21
  "dependencies": {
22
- "jest-get-type": "30.0.0-alpha.2"
22
+ "jest-get-type": "30.0.0-alpha.3"
23
23
  },
24
24
  "devDependencies": {
25
- "@tsd/typescript": "^5.0.4",
26
25
  "immutable": "^4.0.0",
27
- "jest-matcher-utils": "30.0.0-alpha.2",
28
- "tsd-lite": "^0.8.0"
26
+ "jest-matcher-utils": "30.0.0-alpha.3"
29
27
  },
30
28
  "engines": {
31
29
  "node": "^16.10.0 || ^18.12.0 || >=20.0.0"
@@ -33,5 +31,5 @@
33
31
  "publishConfig": {
34
32
  "access": "public"
35
33
  },
36
- "gitHead": "c04d13d7abd22e47b0997f6027886aed225c9ce4"
34
+ "gitHead": "e267aff33d105399f2134bad7c8f82285104f3da"
37
35
  }