simplify failure message logic in the toThrow matcher

This commit is contained in:
Sheel Choksi
2013-04-06 22:06:14 -07:00
parent eec6d7d23e
commit 2445fb36dc
2 changed files with 2 additions and 2 deletions

View File

@@ -1364,7 +1364,7 @@ jasmine.Matchers.prototype.toThrow = function(expected) {
var not = this.isNot ? "not " : "";
this.message = function() {
if (exception && (jasmine.util.isUndefined(expected) || !this.env.equals_(exception.message || exception, expected.message || expected))) {
if (exception) {
return ["Expected function " + not + "to throw", expected ? expected.message || expected : "an exception", ", but it threw", exception.message || exception].join(' ');
} else {
return "Expected function to throw an exception.";

View File

@@ -239,7 +239,7 @@ jasmine.Matchers.prototype.toThrow = function(expected) {
var not = this.isNot ? "not " : "";
this.message = function() {
if (exception && (jasmine.util.isUndefined(expected) || !this.env.equals_(exception.message || exception, expected.message || expected))) {
if (exception) {
return ["Expected function " + not + "to throw", expected ? expected.message || expected : "an exception", ", but it threw", exception.message || exception].join(' ');
} else {
return "Expected function to throw an exception.";