Skip to content

Commit

Permalink
assert: .fail() parameter mismatch. Closes #206
Browse files Browse the repository at this point in the history
  • Loading branch information
logicalparadox committed Jan 29, 2014
1 parent 1e6b305 commit b01eba7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions lib/chai/interface/assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,12 @@ module.exports = function (chai, util) {
*/

assert.fail = function (actual, expected, message, operator) {
throw new chai.AssertionError({
message = message || 'assert.fail()';
throw new chai.AssertionError(message, {
actual: actual
, expected: expected
, message: message
, operator: operator
, stackStartFunction: assert.fail
});
}, assert.fail);
};

/**
Expand Down
4 changes: 2 additions & 2 deletions test/assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ describe('assert', function () {

it('fail', function () {
chai.expect(function () {
assert.fail();
}).to.throw(chai.AssertionError);
assert.fail(0, 1, 'this has failed');
}).to.throw(chai.AssertionError, /this has failed/);
});

it('isTrue', function () {
Expand Down

0 comments on commit b01eba7

Please sign in to comment.