Skip to content

Commit

Permalink
fix: Fix handle error instance test case
Browse files Browse the repository at this point in the history
Error objects are compared by reference now in deep-eql:
https://github.com/chaijs/deep-eql

See Chai issue #608:
expect.eql() returns true when deeply comparing different Error objects #608
chaijs/chai#608
  • Loading branch information
amobiz committed Jan 13, 2018
1 parent cc1665a commit e66a5bb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ var _it = it;

var test = require('../');

var errorInstance = new RangeError('Error objects are compared by reference (see https://github.com/chaijs/chai/issues/608)');

describe('mocha-cases', function () {
describe('dealing with single test value', function () {
var cases = [{
Expand Down Expand Up @@ -176,16 +178,16 @@ describe('mocha-cases', function () {
error: Error,
runner: function error(value, options, done) {
process.nextTick(function () {
done(new RangeError());
done(errorInstance);
});
}
}, {
name: 'should handle error instance',
value: 'the value',
error: new RangeError(),
error: errorInstance,
runner: function error(value, options, done) {
process.nextTick(function () {
done(new RangeError());
done(errorInstance);
});
}
}];
Expand Down

0 comments on commit e66a5bb

Please sign in to comment.