diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index fc750714f..2493bf4f2 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -445,7 +445,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) { * that will succeed if every key/value pair in the sample passes the deep equality comparison * with at least one key/value pair in the actual value being compared * @name jasmine.mapContaining - * @since + * @since 3.5.0 * @function * @param {Map} sample - The subset of items that _must_ be in the actual. */ @@ -457,8 +457,8 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) { * Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}), * that will succeed if every item in the sample passes the deep equality comparison * with at least one item in the actual value being compared - * @name jasmine.mapContaining - * @since + * @name jasmine.setContaining + * @since 3.5.0 * @function * @param {Set} sample - The subset of items that _must_ be in the actual. */ @@ -3939,7 +3939,7 @@ getJasmineRequireObj().toBeRejectedWithError = function(j$) { function getExpectedFromArgs(arg1, arg2) { var error, message; - if (typeof arg1 === 'function' && j$.isError_(arg1.prototype)) { + if (isErrorConstructor(arg1)) { error = arg1; message = arg2; } else { @@ -3953,6 +3953,10 @@ getJasmineRequireObj().toBeRejectedWithError = function(j$) { printValue: j$.fnNameFor(error) + (typeof message === 'undefined' ? '' : ': ' + j$.pp(message)) }; } + + function isErrorConstructor(value) { + return typeof value === 'function' && (value === Error || j$.isError_(value.prototype)); + } }; getJasmineRequireObj().toBeResolved = function(j$) { @@ -4011,24 +4015,24 @@ getJasmineRequireObj().toBeResolvedTo = function(j$) { return actualPromise.then( function(actualValue) { - if (util.equals(actualValue, expectedValue, customEqualityTesters)) { - return { - pass: true, - message: prefix(true) + '.' - }; - } else { + if (util.equals(actualValue, expectedValue, customEqualityTesters)) { + return { + pass: true, + message: prefix(true) + '.' + }; + } else { + return { + pass: false, + message: prefix(false) + ' but it was resolved to ' + j$.pp(actualValue) + '.' + }; + } + }, + function() { return { pass: false, - message: prefix(false) + ' but it was resolved to ' + j$.pp(actualValue) + '.' + message: prefix(false) + ' but it was rejected.' }; } - }, - function() { - return { - pass: false, - message: prefix(false) + ' but it was rejected.' - }; - } ); } };