Comparing version 29.4.2 to 29.4.3
@@ -10,3 +10,3 @@ 'use strict'; | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
@@ -13,0 +13,0 @@ * This source code is licensed under the MIT license found in the |
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
@@ -4,0 +4,0 @@ * This source code is licensed under the MIT license found in the |
@@ -12,3 +12,3 @@ 'use strict'; | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
@@ -15,0 +15,0 @@ * This source code is licensed under the MIT license found in the |
@@ -17,3 +17,3 @@ 'use strict'; | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
@@ -20,0 +20,0 @@ * This source code is licensed under the MIT license found in the |
@@ -12,3 +12,3 @@ 'use strict'; | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
@@ -15,0 +15,0 @@ * This source code is licensed under the MIT license found in the |
@@ -12,3 +12,3 @@ 'use strict'; | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
@@ -207,3 +207,9 @@ * This source code is licensed under the MIT license found in the | ||
const toThrowExpectedObject = (matcherName, options, thrown, expected) => { | ||
const pass = thrown !== null && thrown.message === expected.message; | ||
const expectedMessageAndCause = createMessageAndCause(expected); | ||
const thrownMessageAndCause = | ||
thrown !== null ? createMessageAndCause(thrown.value) : null; | ||
const pass = | ||
thrown !== null && | ||
thrown.message === expected.message && | ||
thrownMessageAndCause === expectedMessageAndCause; | ||
const message = pass | ||
@@ -219,3 +225,6 @@ ? () => | ||
'\n\n' + | ||
formatExpected('Expected message: not ', expected.message) + | ||
formatExpected( | ||
`Expected ${messageAndCause(expected)}: not `, | ||
expectedMessageAndCause | ||
) + | ||
(thrown !== null && thrown.hasMessage | ||
@@ -235,3 +244,6 @@ ? formatStack(thrown) | ||
? // eslint-disable-next-line prefer-template | ||
formatExpected('Expected message: ', expected.message) + | ||
formatExpected( | ||
`Expected ${messageAndCause(expected)}: `, | ||
expectedMessageAndCause | ||
) + | ||
'\n' + | ||
@@ -242,6 +254,6 @@ DID_NOT_THROW | ||
(0, _jestMatcherUtils.printDiffOrStringify)( | ||
expected.message, | ||
thrown.message, | ||
'Expected message', | ||
'Received message', | ||
expectedMessageAndCause, | ||
thrownMessageAndCause, | ||
`Expected ${messageAndCause(expected)}`, | ||
`Received ${messageAndCause(thrown.value)}`, | ||
true | ||
@@ -251,4 +263,6 @@ ) + | ||
formatStack(thrown) | ||
: formatExpected('Expected message: ', expected.message) + | ||
formatReceived('Received value: ', thrown, 'value')); | ||
: formatExpected( | ||
`Expected ${messageAndCause(expected)}: `, | ||
expectedMessageAndCause | ||
) + formatReceived('Received value: ', thrown, 'value')); | ||
return { | ||
@@ -455,3 +469,20 @@ message, | ||
); | ||
function createMessageAndCauseMessage(error) { | ||
if (error.cause instanceof Error) { | ||
return `{ message: ${error.message}, cause: ${createMessageAndCauseMessage( | ||
error.cause | ||
)}}`; | ||
} | ||
return `{ message: ${error.message} }`; | ||
} | ||
function createMessageAndCause(error) { | ||
if (error.cause instanceof Error) { | ||
return createMessageAndCauseMessage(error); | ||
} | ||
return error.message; | ||
} | ||
function messageAndCause(error) { | ||
return error.cause === undefined ? 'message' : 'message and cause'; | ||
} | ||
var _default = matchers; | ||
exports.default = _default; |
{ | ||
"name": "expect", | ||
"version": "29.4.2", | ||
"version": "29.4.3", | ||
"repository": { | ||
@@ -22,11 +22,11 @@ "type": "git", | ||
"dependencies": { | ||
"@jest/expect-utils": "^29.4.2", | ||
"jest-get-type": "^29.4.2", | ||
"jest-matcher-utils": "^29.4.2", | ||
"jest-message-util": "^29.4.2", | ||
"jest-util": "^29.4.2" | ||
"@jest/expect-utils": "^29.4.3", | ||
"jest-get-type": "^29.4.3", | ||
"jest-matcher-utils": "^29.4.3", | ||
"jest-message-util": "^29.4.3", | ||
"jest-util": "^29.4.3" | ||
}, | ||
"devDependencies": { | ||
"@fast-check/jest": "^1.3.0", | ||
"@jest/test-utils": "^29.4.2", | ||
"@jest/test-utils": "^29.4.3", | ||
"@tsd/typescript": "^4.9.0", | ||
@@ -43,3 +43,3 @@ "chalk": "^4.0.0", | ||
}, | ||
"gitHead": "f0fc92e8443f09546c7ec0472bf9bce44fe5898f" | ||
"gitHead": "a49c88610e49a3242576160740a32a2fe11161e1" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
145598
4425
Updated@jest/expect-utils@^29.4.3
Updatedjest-get-type@^29.4.3
Updatedjest-matcher-utils@^29.4.3
Updatedjest-message-util@^29.4.3
Updatedjest-util@^29.4.3