Comparing version 0.1.2 to 0.1.3
40
chai.js
!function (name, definition) { | ||
if (typeof define == 'function' && typeof define.amd == 'object') define(definition); | ||
else this[name] = definition(); | ||
console.log(this); | ||
}('chai', function () { | ||
@@ -114,3 +112,4 @@ | ||
function Assertion (obj, msg) { | ||
function Assertion (obj, msg, stack) { | ||
this.ssfi = stack || arguments.callee; | ||
this.obj = obj; | ||
@@ -123,4 +122,3 @@ this.msg = msg; | ||
* | ||
* Executes an expression and check expectations. | ||
* Throws AssertionError for reporting. | ||
* Executes an expression and check expectations. Throws AssertionError for reporting if test doesn't pass. | ||
* | ||
@@ -135,3 +133,3 @@ * @name assert | ||
Assertion.prototype.assert = function (expr, msg, negateMsg) { | ||
var msg = (this.msg ? this.msg + ': ' : '') + (this.negate ? negateMsg : msg) | ||
var msg = (this.negate ? negateMsg : msg) | ||
, ok = this.negate ? !expr : expr; | ||
@@ -141,4 +139,5 @@ | ||
throw new AssertionError({ | ||
operator: this.msg, | ||
message: msg, | ||
startStackFunction: this.assert | ||
stackStartFunction: this.ssfi | ||
}); | ||
@@ -577,4 +576,3 @@ } | ||
* | ||
* Assert that property of `name` exists, | ||
* optionally with `value`. | ||
* Assert that property of `name` exists, optionally with `value`. | ||
* | ||
@@ -688,3 +686,3 @@ * var obj = { foo: 'bar' } | ||
* | ||
* Assert the inclusion of an object in an Array | ||
* Assert the inclusion of an object in an Array or substring in string. | ||
* | ||
@@ -751,4 +749,3 @@ * expect([1,2,3]).to.contain(2); | ||
* | ||
* Assert exact keys or the inclusing of keys using | ||
* the `contain` modifier. | ||
* Assert exact keys or the inclusing of keys using the `contain` modifier. | ||
* | ||
@@ -816,4 +813,3 @@ * expect({ foo: 1, bar: 2 }).to.have.keys(['foo', 'bar']); | ||
* | ||
* Assert that a function will throw a specific | ||
* type of error. | ||
* Assert that a function will throw a specific type of error. | ||
* | ||
@@ -884,3 +880,3 @@ * var fn = function () { throw new ReferenceError(''); } | ||
* | ||
* @name json | ||
* @name status | ||
* @param {Number} code | ||
@@ -960,3 +956,3 @@ * @api public | ||
exports.version = '0.1.1'; | ||
exports.version = '0.1.3'; | ||
@@ -1014,7 +1010,15 @@ exports.expect = require('./interface/expect'); | ||
AssertionError.prototype.summary = function() { | ||
return this.name + (this.message ? ': ' + this.message : ''); | ||
var str = ''; | ||
if (this.operator) { | ||
str += 'In: \'' + this.operator + '\'\n\t'; | ||
} | ||
str += '' + this.name + (this.message ? ': ' + this.message : ''); | ||
return str; | ||
}; | ||
AssertionError.prototype.details = function() { | ||
return 'In "' + this.operator + '":\n\tExpected: ' + this.expected + '\n\tFound: ' + this.actual; | ||
return this.summary(); | ||
}; | ||
@@ -1021,0 +1025,0 @@ |
0.1.3 / 2011-12-18 | ||
================== | ||
* much cleaner reporting string on error. | ||
0.1.2 / 2011-12-18 | ||
@@ -3,0 +8,0 @@ ================== |
@@ -59,3 +59,4 @@ /*! | ||
function Assertion (obj, msg) { | ||
function Assertion (obj, msg, stack) { | ||
this.ssfi = stack || arguments.callee; | ||
this.obj = obj; | ||
@@ -78,3 +79,3 @@ this.msg = msg; | ||
Assertion.prototype.assert = function (expr, msg, negateMsg) { | ||
var msg = (this.msg ? this.msg + ': ' : '') + (this.negate ? negateMsg : msg) | ||
var msg = (this.negate ? negateMsg : msg) | ||
, ok = this.negate ? !expr : expr; | ||
@@ -84,4 +85,5 @@ | ||
throw new AssertionError({ | ||
operator: this.msg, | ||
message: msg, | ||
startStackFunction: this.assert | ||
stackStartFunction: this.ssfi | ||
}); | ||
@@ -88,0 +90,0 @@ } |
@@ -9,3 +9,3 @@ /*! | ||
exports.version = '0.1.2'; | ||
exports.version = '0.1.3'; | ||
@@ -12,0 +12,0 @@ exports.expect = require('./interface/expect'); |
@@ -32,7 +32,15 @@ /*! | ||
AssertionError.prototype.summary = function() { | ||
return this.name + (this.message ? ': ' + this.message : ''); | ||
var str = ''; | ||
if (this.operator) { | ||
str += 'In: \'' + this.operator + '\'\n\t'; | ||
} | ||
str += '' + this.name + (this.message ? ': ' + this.message : ''); | ||
return str; | ||
}; | ||
AssertionError.prototype.details = function() { | ||
return 'In "' + this.operator + '":\n\tExpected: ' + this.expected + '\n\tFound: ' + this.actual; | ||
return this.summary(); | ||
}; | ||
@@ -39,0 +47,0 @@ |
@@ -6,3 +6,3 @@ { | ||
"keywords": [ "test", "assertion", "assert", "testing" ], | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"repository": { | ||
@@ -9,0 +9,0 @@ "type": "git", |
Sorry, the diff of this file is not supported yet
130163
4090