mirror of
https://github.com/chaijs/chai
synced 2024-11-14 15:57:10 +00:00
Release 0.4.2
This commit is contained in:
parent
00ed5a706d
commit
dc2ea1324d
11 changed files with 214 additions and 23 deletions
32
History.md
32
History.md
|
@ -1,4 +1,36 @@
|
|||
|
||||
0.4.2 / 2012-02-28
|
||||
==================
|
||||
|
||||
* fix for `process` not available in browser when used via browserify. Closes #28
|
||||
* Merge pull request #31 from joliss/doc
|
||||
* Document that "should" works in browsers other than IE
|
||||
* Merge pull request #30 from logicalparadox/assert-tests
|
||||
* Update the browser version of chai.
|
||||
* Update `assert.doesNotThrow` test in order to check the use case when type is a string.
|
||||
* Add test for `assert.ifError`.
|
||||
* Falsey -> falsy.
|
||||
* Full coverage for `assert.throws` and `assert.doesNotThrow`.
|
||||
* Add test for `assert.doesNotThrow`.
|
||||
* Add test for `assert.throws`.
|
||||
* Add test for `assert.length`.
|
||||
* Add test for `assert.include`.
|
||||
* Add test for `assert.isBoolean`.
|
||||
* Fix the implementation of `assert.isNumber`.
|
||||
* Add test for `assert.isNumber`.
|
||||
* Add test for `assert.isString`.
|
||||
* Add test for `assert.isArray`.
|
||||
* Add test for `assert.isUndefined`.
|
||||
* Add test for `assert.isNotNull`.
|
||||
* Fix `assert.isNotNull` implementation.
|
||||
* Fix `assert.isNull` implementation.
|
||||
* Add test for `assert.isNull`.
|
||||
* Add test for `assert.notDeepEqual`.
|
||||
* Add test for `assert.deepEqual`.
|
||||
* Add test for `assert.notStrictEqual`.
|
||||
* Add test for `assert.strictEqual`.
|
||||
* Add test for `assert.notEqual`.
|
||||
|
||||
0.4.1 / 2012-02-26
|
||||
==================
|
||||
|
||||
|
|
8
chai.js
8
chai.js
|
@ -79,11 +79,11 @@ require.register("assertion.js", function(module, exports, require){
|
|||
* #### Differences
|
||||
*
|
||||
* The `expect` interface provides a function as a starting point for chaining
|
||||
* your language assertions. It works on both node.js and in the browser.
|
||||
* your language assertions. It works on node.js and in all browsers.
|
||||
*
|
||||
* The `should` interface extends `Object.prototype` to provide a single getter as
|
||||
* the starting point for your language assertions. Most browser don't like
|
||||
* extensions to `Object.prototype` so it is not recommended for browser use.
|
||||
* the starting point for your language assertions. It works on node.js and in
|
||||
* all browsers except Internet Explorer.
|
||||
*
|
||||
* #### Configuration
|
||||
*
|
||||
|
@ -1010,7 +1010,7 @@ require.register("chai.js", function(module, exports, require){
|
|||
var used = [];
|
||||
var exports = module.exports = {};
|
||||
|
||||
exports.version = '0.4.1';
|
||||
exports.version = '0.4.2';
|
||||
|
||||
exports.Assertion = require('./assertion');
|
||||
exports.AssertionError = require('./error');
|
||||
|
|
|
@ -79,11 +79,11 @@ require.register("assertion.js", function(module, exports, require){
|
|||
* #### Differences
|
||||
*
|
||||
* The `expect` interface provides a function as a starting point for chaining
|
||||
* your language assertions. It works on both node.js and in the browser.
|
||||
* your language assertions. It works on node.js and in all browsers.
|
||||
*
|
||||
* The `should` interface extends `Object.prototype` to provide a single getter as
|
||||
* the starting point for your language assertions. Most browser don't like
|
||||
* extensions to `Object.prototype` so it is not recommended for browser use.
|
||||
* the starting point for your language assertions. It works on node.js and in
|
||||
* all browsers except Internet Explorer.
|
||||
*
|
||||
* #### Configuration
|
||||
*
|
||||
|
@ -345,7 +345,7 @@ Object.defineProperty(Assertion.prototype, 'ok',
|
|||
this.assert(
|
||||
this.obj
|
||||
, 'expected ' + this.inspect + ' to be truthy'
|
||||
, 'expected ' + this.inspect + ' to be falsey');
|
||||
, 'expected ' + this.inspect + ' to be falsy');
|
||||
|
||||
return this;
|
||||
},
|
||||
|
@ -1010,7 +1010,7 @@ require.register("chai.js", function(module, exports, require){
|
|||
var used = [];
|
||||
var exports = module.exports = {};
|
||||
|
||||
exports.version = '0.4.1';
|
||||
exports.version = '0.4.2';
|
||||
|
||||
exports.Assertion = require('./assertion');
|
||||
exports.AssertionError = require('./error');
|
||||
|
@ -1329,7 +1329,7 @@ module.exports = function (chai) {
|
|||
*/
|
||||
|
||||
assert.isNull = function (val, msg) {
|
||||
new Assertion(val, msg).to.not.exist;
|
||||
new Assertion(val, msg).to.equal(null);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1347,7 +1347,7 @@ module.exports = function (chai) {
|
|||
*/
|
||||
|
||||
assert.isNotNull = function (val, msg) {
|
||||
new Assertion(val, msg).to.exist;
|
||||
new Assertion(val, msg).to.not.equal(null);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1454,7 +1454,7 @@ module.exports = function (chai) {
|
|||
*/
|
||||
|
||||
assert.isNumber = function (val, msg) {
|
||||
new Assertion(val, msg).to.be.instanceof(Number);
|
||||
new Assertion(val, msg).to.be.a('number');
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -499,7 +499,7 @@ _gaq.push(['_trackPageview']);
|
|||
</div>
|
||||
<div class="code-wrap">
|
||||
<pre class="source prettyprint"><code>assert.isNull = function (val, msg) {
|
||||
new Assertion(val, msg).to.not.exist;
|
||||
new Assertion(val, msg).to.equal(null);
|
||||
};</code>
|
||||
</pre>
|
||||
</div>
|
||||
|
@ -530,7 +530,7 @@ _gaq.push(['_trackPageview']);
|
|||
</div>
|
||||
<div class="code-wrap">
|
||||
<pre class="source prettyprint"><code>assert.isNotNull = function (val, msg) {
|
||||
new Assertion(val, msg).to.exist;
|
||||
new Assertion(val, msg).to.not.equal(null);
|
||||
};</code>
|
||||
</pre>
|
||||
</div>
|
||||
|
@ -715,7 +715,7 @@ _gaq.push(['_trackPageview']);
|
|||
</div>
|
||||
<div class="code-wrap">
|
||||
<pre class="source prettyprint"><code>assert.isNumber = function (val, msg) {
|
||||
new Assertion(val, msg).to.be.instanceof(Number);
|
||||
new Assertion(val, msg).to.be.a('number');
|
||||
};</code>
|
||||
</pre>
|
||||
</div>
|
||||
|
|
|
@ -181,9 +181,9 @@ _gaq.push(['_trackPageview']);
|
|||
|
||||
<h4>Differences</h4>
|
||||
|
||||
<p>The <code>expect</code> interface provides a function as a starting point for chaining<br />your language assertions. It works on both node.js and in the browser.</p>
|
||||
<p>The <code>expect</code> interface provides a function as a starting point for chaining<br />your language assertions. It works on node.js and in all browsers.</p>
|
||||
|
||||
<p>The <code>should</code> interface extends <code>Object.prototype</code> to provide a single getter as<br />the starting point for your language assertions. Most browser don't like<br />extensions to <code>Object.prototype</code> so it is not recommended for browser use.</p>
|
||||
<p>The <code>should</code> interface extends <code>Object.prototype</code> to provide a single getter as<br />the starting point for your language assertions. It works on node.js and in<br />all browsers except Internet Explorer.</p>
|
||||
|
||||
<h4>Configuration</h4>
|
||||
|
||||
|
@ -418,7 +418,7 @@ _gaq.push(['_trackPageview']);
|
|||
this.assert(
|
||||
this.obj
|
||||
, 'expected ' + this.inspect + ' to be truthy'
|
||||
, 'expected ' + this.inspect + ' to be falsey');
|
||||
, 'expected ' + this.inspect + ' to be falsy');
|
||||
|
||||
return this;
|
||||
},
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -114,4 +114,163 @@ suite('assert', function () {
|
|||
}, "expected 'foo' to be a object");
|
||||
});
|
||||
|
||||
test('notEqual', function() {
|
||||
assert.notEqual(3, 4);
|
||||
|
||||
err(function () {
|
||||
assert.notEqual(5, 5);
|
||||
}, "expected 5 to equal 5");
|
||||
});
|
||||
|
||||
test('strictEqual', function() {
|
||||
assert.strictEqual('foo', 'foo');
|
||||
|
||||
err(function () {
|
||||
assert.strictEqual('5', 5);
|
||||
}, "expected \'5\' to equal 5");
|
||||
});
|
||||
|
||||
test('notStrictEqual', function() {
|
||||
assert.notStrictEqual(5, '5');
|
||||
|
||||
err(function () {
|
||||
assert.notStrictEqual(5, 5);
|
||||
}, "expected 5 to not equal 5");
|
||||
});
|
||||
|
||||
test('deepEqual', function() {
|
||||
assert.deepEqual({tea: 'chai'}, {tea: 'chai'});
|
||||
|
||||
err(function () {
|
||||
assert.deepEqual({tea: 'chai'}, {tea: 'black'});
|
||||
}, "expected { tea: \'chai\' } to equal { tea: \'black\' }");
|
||||
});
|
||||
|
||||
test('notDeepEqual', function() {
|
||||
assert.notDeepEqual({tea: 'jasmine'}, {tea: 'chai'});
|
||||
|
||||
err(function () {
|
||||
assert.notDeepEqual({tea: 'chai'}, {tea: 'chai'});
|
||||
}, "expected { tea: \'chai\' } to not equal { tea: \'chai\' }");
|
||||
});
|
||||
|
||||
test('isNull', function() {
|
||||
assert.isNull(null);
|
||||
|
||||
err(function () {
|
||||
assert.isNull(undefined);
|
||||
}, "expected undefined to equal null");
|
||||
});
|
||||
|
||||
test('isNotNull', function() {
|
||||
assert.isNotNull(undefined);
|
||||
|
||||
err(function () {
|
||||
assert.isNotNull(null);
|
||||
}, "expected null to not equal null");
|
||||
});
|
||||
|
||||
test('isUndefined', function() {
|
||||
assert.isUndefined(undefined);
|
||||
|
||||
err(function () {
|
||||
assert.isUndefined(null);
|
||||
}, "expected null to equal undefined");
|
||||
});
|
||||
|
||||
test('isFunction', function() {
|
||||
var func = function() {};
|
||||
assert.isFunction(func);
|
||||
|
||||
err(function () {
|
||||
assert.isFunction({});
|
||||
}, "expected {} to be a function");
|
||||
});
|
||||
|
||||
test('isArray', function() {
|
||||
assert.isArray([]);
|
||||
assert.isArray(new Array);
|
||||
|
||||
err(function () {
|
||||
assert.isArray({});
|
||||
}, "expected {} to be an instance of Array");
|
||||
});
|
||||
|
||||
test('isString', function() {
|
||||
assert.isString('Foo');
|
||||
assert.isString(new String('foo'));
|
||||
|
||||
err(function () {
|
||||
assert.isString(1);
|
||||
}, "expected 1 to be a string");
|
||||
});
|
||||
|
||||
test('isNumber', function() {
|
||||
assert.isNumber(1);
|
||||
assert.isNumber(Number('3'));
|
||||
|
||||
err(function () {
|
||||
assert.isNumber('1');
|
||||
}, "expected \'1\' to be a number");
|
||||
});
|
||||
|
||||
test('isBoolean', function() {
|
||||
assert.isBoolean(true);
|
||||
assert.isBoolean(false);
|
||||
|
||||
err(function () {
|
||||
assert.isBoolean('1');
|
||||
}, "expected \'1\' to be a boolean");
|
||||
});
|
||||
|
||||
test('include', function() {
|
||||
assert.include('foobar', 'bar');
|
||||
assert.include([ 1, 2, 3], 3);
|
||||
|
||||
err(function () {
|
||||
assert.include('foobar', 'baz');
|
||||
}, "expected \'foobar\' to contain \'baz\'");
|
||||
});
|
||||
|
||||
test('length', function() {
|
||||
assert.length([1,2,3], 3);
|
||||
assert.length('foobar', 6);
|
||||
|
||||
err(function () {
|
||||
assert.length('foobar', 5);
|
||||
}, "expected 'foobar' to have a length of 5 but got 6");
|
||||
|
||||
err(function () {
|
||||
assert.length(1, 5);
|
||||
}, "expected 1 to have a property \'length\'");
|
||||
});
|
||||
|
||||
test('throws', function() {
|
||||
assert.throws(function() { throw new Error('foo'); });
|
||||
assert.throws(function() { throw new Error('bar'); }, 'foo');
|
||||
|
||||
err(function () {
|
||||
assert.throws(function() {});
|
||||
}, "expected [Function] to throw an error");
|
||||
});
|
||||
|
||||
test('doesNotThrow', function() {
|
||||
assert.doesNotThrow(function() { });
|
||||
assert.doesNotThrow(function() { }, 'foo');
|
||||
|
||||
err(function () {
|
||||
assert.doesNotThrow(function() { throw new Error('foo'); });
|
||||
}, 'expected [Function] to not throw an error');
|
||||
});
|
||||
|
||||
test('ifError', function() {
|
||||
assert.ifError(false);
|
||||
assert.ifError(null);
|
||||
assert.ifError(undefined);
|
||||
|
||||
err(function () {
|
||||
assert.ifError('foo');
|
||||
}, "expected \'foo\' to be falsy");
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -56,7 +56,7 @@ suite('expect', function () {
|
|||
|
||||
err(function(){
|
||||
expect('test').to.not.be.ok;
|
||||
}, "expected 'test' to be falsey");
|
||||
}, "expected 'test' to be falsy");
|
||||
});
|
||||
|
||||
test('false', function(){
|
||||
|
|
|
@ -70,7 +70,7 @@ suite('should', function() {
|
|||
|
||||
err(function(){
|
||||
'test'.should.not.be.ok;
|
||||
}, "expected 'test' to be falsey");
|
||||
}, "expected 'test' to be falsy");
|
||||
});
|
||||
|
||||
test('false', function(){
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
var used = [];
|
||||
var exports = module.exports = {};
|
||||
|
||||
exports.version = '0.4.1';
|
||||
exports.version = '0.4.2';
|
||||
|
||||
exports.Assertion = require('./assertion');
|
||||
exports.AssertionError = require('./error');
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"name": "chai",
|
||||
"description": "BDD/TDD assertion library for node.js and the browser. Test framework agnostic.",
|
||||
"keywords": [ "test", "assertion", "assert", "testing" ],
|
||||
"version": "0.4.1",
|
||||
"version": "0.4.2",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/logicalparadox/chai"
|
||||
|
|
Loading…
Reference in a new issue