expect
Advanced tools
Comparing version 21.0.2 to 21.1.0
@@ -33,3 +33,2 @@ 'use strict';Object.defineProperty(exports, "__esModule", { value: true }); | ||
var _jasmine_utils = require('./jasmine_utils');function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };} | ||
@@ -520,10 +519,2 @@ | ||
let diffString; | ||
if (valuePassed && (0, _utils.hasOwnProperty)(result, 'value')) { | ||
diffString = (0, _jestDiff2.default)(value, result.value, { | ||
expand: this.expand }); | ||
} | ||
const pass = valuePassed ? | ||
@@ -533,7 +524,2 @@ (0, _jasmine_utils.equals)(result.value, value, [_utils.iterableEquality]) : | ||
if ((0, _utils.hasOwnProperty)(result, 'value')) { | ||
// we don't diff numbers. So instead we'll show the object that contains the resulting value. | ||
// And to get that object we need to go up a level. | ||
result.traversedPath.pop(); | ||
} | ||
const traversedPath = result.traversedPath.join('.'); | ||
@@ -552,18 +538,30 @@ | ||
valuePassed ? `With a value of:\n ${(0, _jestMatcherUtils.printExpected)(value)}\n` : '') : | ||
() => | ||
(0, _jestMatcherUtils.matcherHint)('.toHaveProperty', 'object', 'path', { | ||
secondArgument: valuePassed ? 'value' : null }) + | ||
() => { | ||
const diffString = | ||
valuePassed && hasEndProp ? | ||
(0, _jestDiff2.default)(value, result.value, { expand: this.expand }) : | ||
''; | ||
return ( | ||
(0, _jestMatcherUtils.matcherHint)('.toHaveProperty', 'object', 'path', { | ||
secondArgument: valuePassed ? 'value' : null }) + | ||
'\n\n' + | ||
`Expected the object:\n` + | ||
` ${(0, _jestMatcherUtils.printReceived)(object)}\n` + | ||
`To have a nested property:\n` + | ||
` ${(0, _jestMatcherUtils.printExpected)(keyPath)}\n` + ( | ||
valuePassed ? `With a value of:\n ${(0, _jestMatcherUtils.printExpected)(value)}\n` : '') + ( | ||
traversedPath ? | ||
`Received:\n ${(0, _jestMatcherUtils.RECEIVED_COLOR)( | ||
'object') | ||
}.${traversedPath}: ${(0, _jestMatcherUtils.printReceived)(lastTraversedObject)}` : | ||
'') + ( | ||
diffString ? `\nDifference:\n\n${diffString}` : ''); | ||
'\n\n' + | ||
`Expected the object:\n` + | ||
` ${(0, _jestMatcherUtils.printReceived)(object)}\n` + | ||
`To have a nested property:\n` + | ||
` ${(0, _jestMatcherUtils.printExpected)(keyPath)}\n` + ( | ||
valuePassed ? | ||
`With a value of:\n ${(0, _jestMatcherUtils.printExpected)(value)}\n` : | ||
'') + ( | ||
hasEndProp ? | ||
`Received:\n` + | ||
` ${(0, _jestMatcherUtils.printReceived)(result.value)}` + ( | ||
diffString ? `\n\nDifference:\n\n${diffString}` : '') : | ||
traversedPath ? | ||
`Received:\n ${(0, _jestMatcherUtils.RECEIVED_COLOR)( | ||
'object') | ||
}.${traversedPath}: ${(0, _jestMatcherUtils.printReceived)(lastTraversedObject)}` : | ||
'')); | ||
}; | ||
if (pass === undefined) { | ||
@@ -570,0 +568,0 @@ throw new Error('pass must be initialized'); |
@@ -117,12 +117,25 @@ 'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports.partition = exports.subsetEquality = exports.iterableEquality = exports.getObjectSubset = exports.getPath = exports.hasOwnProperty = undefined; | ||
return false; | ||
} else { | ||
const args = []; | ||
} else if ((0, _jasmine_utils.isA)('Set', a)) { | ||
let allFound = true; | ||
for (const aValue of a) { | ||
args.push(aValue); | ||
if (!b.has(aValue)) { | ||
allFound = false; | ||
break; | ||
} | ||
} | ||
for (const bValue of b) { | ||
args.push(bValue); | ||
if (allFound) { | ||
return true; | ||
} | ||
const merged = new a.constructor(args); | ||
if (merged.size === a.size) { | ||
} else if ((0, _jasmine_utils.isA)('Map', a)) { | ||
let allFound = true; | ||
for (const aEntry of a) { | ||
if ( | ||
!b.has(aEntry[0]) || | ||
!(0, _jasmine_utils.equals)(aEntry[1], b.get(aEntry[0]), [iterableEquality])) | ||
{ | ||
allFound = false; | ||
break; | ||
} | ||
} | ||
if (allFound) { | ||
return true; | ||
@@ -129,0 +142,0 @@ } |
{ | ||
"name": "expect", | ||
"version": "21.0.2", | ||
"version": "21.1.0", | ||
"repository": { | ||
@@ -13,8 +13,8 @@ "type": "git", | ||
"ansi-styles": "^3.2.0", | ||
"jest-diff": "^21.0.2", | ||
"jest-diff": "^21.1.0", | ||
"jest-get-type": "^21.0.2", | ||
"jest-matcher-utils": "^21.0.2", | ||
"jest-message-util": "^21.0.2", | ||
"jest-regex-util": "^21.0.2" | ||
"jest-matcher-utils": "^21.1.0", | ||
"jest-message-util": "^21.1.0", | ||
"jest-regex-util": "^21.1.0" | ||
} | ||
} |
Sorry, the diff of this file is too big to display
SPDX disjunction
LicenseSPDX disjunction for an artifact's license information
Found 1 instance in 1 package
SPDX disjunction
LicenseSPDX disjunction for an artifact's license information
Found 1 instance in 1 package
503977
13198
Updatedjest-diff@^21.1.0
Updatedjest-matcher-utils@^21.1.0
Updatedjest-message-util@^21.1.0
Updatedjest-regex-util@^21.1.0