From 9ccf2ef96b59f8e6e181caff69800f5da2aef020 Mon Sep 17 00:00:00 2001 From: Steve Gravrock Date: Sat, 5 Oct 2024 13:55:49 -0700 Subject: [PATCH] Also deprecate the expected and actual properties of ThrowUnlessFailure --- lib/jasmine-core/jasmine.js | 11 +++++++++-- src/core/Env.js | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index b9a815df..81d48cb3 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -1430,11 +1430,18 @@ getJasmineRequireObj().Env = function(j$) { * @description Represents a failure of an expectation evaluated with * {@link throwUnless}. Properties of this error are a subset of the * properties of {@link ExpectationResult} and have the same values. + * + * Note: The expected and actual properties are deprecated and may be removed + * in a future release. In many Jasmine configurations they are passed + * through JSON serialization and deserialization, which is inherently + * lossy. In such cases, the expected and actual values may be placeholders + * or approximations of the original objects. + * * @property {String} matcherName - The name of the matcher that was executed for this expectation. * @property {String} message - The failure message for the expectation. * @property {Boolean} passed - Whether the expectation passed or failed. - * @property {Object} expected - If the expectation failed, what was the expected value. - * @property {Object} actual - If the expectation failed, what actual value was produced. + * @property {Object} expected - Deprecated. If the expectation failed, what was the expected value. + * @property {Object} actual - Deprecated. If the expectation failed, what actual value was produced. */ const error = new Error(result.message); error.passed = result.passed; diff --git a/src/core/Env.js b/src/core/Env.js index 402cd53a..e48e6395 100644 --- a/src/core/Env.js +++ b/src/core/Env.js @@ -273,11 +273,18 @@ getJasmineRequireObj().Env = function(j$) { * @description Represents a failure of an expectation evaluated with * {@link throwUnless}. Properties of this error are a subset of the * properties of {@link ExpectationResult} and have the same values. + * + * Note: The expected and actual properties are deprecated and may be removed + * in a future release. In many Jasmine configurations they are passed + * through JSON serialization and deserialization, which is inherently + * lossy. In such cases, the expected and actual values may be placeholders + * or approximations of the original objects. + * * @property {String} matcherName - The name of the matcher that was executed for this expectation. * @property {String} message - The failure message for the expectation. * @property {Boolean} passed - Whether the expectation passed or failed. - * @property {Object} expected - If the expectation failed, what was the expected value. - * @property {Object} actual - If the expectation failed, what actual value was produced. + * @property {Object} expected - Deprecated. If the expectation failed, what was the expected value. + * @property {Object} actual - Deprecated. If the expectation failed, what actual value was produced. */ const error = new Error(result.message); error.passed = result.passed;