Socket
Socket
Sign inDemoInstall

expect

Package Overview
Dependencies
41
Maintainers
5
Versions
236
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 28.0.0-alpha.4 to 28.0.0-alpha.5

10

build/jestMatchersObject.js

@@ -13,2 +13,4 @@ 'use strict';

var _jestGetType = require('jest-get-type');
var _asymmetricMatchers = require('./asymmetricMatchers');

@@ -57,2 +59,10 @@

const matcher = matchers[key];
if (typeof matcher !== 'function') {
throw new TypeError(
`expect.extend: \`${key}\` is not a valid matcher. Must be a function, is "${(0,
_jestGetType.getType)(matcher)}"`
);
}
Object.defineProperty(matcher, INTERNAL_MATCHER_FLAG, {

@@ -59,0 +69,0 @@ value: isInternal

51

build/matchers.js

@@ -988,49 +988,12 @@ 'use strict';

const result = (0, _expectUtils.getPath)(received, expectedPath);
const {lastTraversedObject, hasEndProp} = result;
const {lastTraversedObject, endPropIsDefined, hasEndProp, value} = result;
const receivedPath = result.traversedPath;
const hasCompletePath = receivedPath.length === expectedPathLength;
const receivedValue = hasCompletePath ? result.value : lastTraversedObject;
const pass = hasValue
? (0, _expectUtils.equals)(result.value, expectedValue, [
_expectUtils.iterableEquality
])
: Boolean(hasEndProp); // theoretically undefined if empty path
// Remove type cast if we rewrite getPath as iterative algorithm.
// Delete this unique report if future breaking change
// removes the edge case that expected value undefined
// also matches absence of a property with the key path.
if (pass && !hasCompletePath) {
const message = () =>
(0, _jestMatcherUtils.matcherHint)(
matcherName,
undefined,
expectedArgument,
options
) +
'\n\n' +
`Expected path: ${(0, _jestMatcherUtils.printExpected)(
expectedPath
)}\n` +
`Received path: ${(0, _jestMatcherUtils.printReceived)(
expectedPathType === 'array' || receivedPath.length === 0
? receivedPath
: receivedPath.join('.')
)}\n\n` +
`Expected value: not ${(0, _jestMatcherUtils.printExpected)(
expectedValue
)}\n` +
`Received value: ${(0, _jestMatcherUtils.printReceived)(
receivedValue
)}\n\n` +
(0, _jestMatcherUtils.DIM_COLOR)(
'Because a positive assertion passes for expected value undefined if the property does not exist, this negative assertion fails unless the property does exist and has a defined value'
);
return {
message,
pass
};
}
const pass =
hasValue && endPropIsDefined
? (0, _expectUtils.equals)(value, expectedValue, [
_expectUtils.iterableEquality
])
: Boolean(hasEndProp);
const message = pass

@@ -1037,0 +1000,0 @@ ? () =>

{
"name": "expect",
"version": "28.0.0-alpha.4",
"version": "28.0.0-alpha.5",
"repository": {

@@ -21,9 +21,9 @@ "type": "git",

"dependencies": {
"@jest/expect-utils": "^28.0.0-alpha.4",
"@jest/expect-utils": "^28.0.0-alpha.5",
"jest-get-type": "^28.0.0-alpha.3",
"jest-matcher-utils": "^28.0.0-alpha.4",
"jest-message-util": "^28.0.0-alpha.4"
"jest-matcher-utils": "^28.0.0-alpha.5",
"jest-message-util": "^28.0.0-alpha.5"
},
"devDependencies": {
"@jest/test-utils": "^28.0.0-alpha.4",
"@jest/test-utils": "^28.0.0-alpha.5",
"@tsd/typescript": "~4.5.5",

@@ -41,3 +41,3 @@ "chalk": "^4.0.0",

},
"gitHead": "c13dab19491ba6b57c2d703e7d7c4b20189e1e17"
"gitHead": "46fb19b2628bd87676c10730ba19592c30b05478"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc