mirror of
https://github.com/chaijs/chai
synced 2024-11-14 15:57:10 +00:00
Merge pull request #1124 from meeber/fix-deep-equal-stack
fix: remove Chai frames from `.deep.equal` stack
This commit is contained in:
commit
c808e11ffc
3 changed files with 33 additions and 1 deletions
|
@ -1016,7 +1016,10 @@ module.exports = function (chai, _) {
|
|||
if (msg) flag(this, 'message', msg);
|
||||
var obj = flag(this, 'object');
|
||||
if (flag(this, 'deep')) {
|
||||
return this.eql(val);
|
||||
var prevLockSsfi = flag(this, 'lockSsfi');
|
||||
flag(this, 'lockSsfi', true);
|
||||
this.eql(val);
|
||||
flag(this, 'lockSsfi', prevLockSsfi);
|
||||
} else {
|
||||
this.assert(
|
||||
val === obj
|
||||
|
|
|
@ -1181,6 +1181,22 @@ describe('expect', function () {
|
|||
it('deep.equal(val)', function(){
|
||||
expect({ foo: 'bar' }).to.deep.equal({ foo: 'bar' });
|
||||
expect({ foo: 'bar' }).not.to.deep.equal({ foo: 'baz' });
|
||||
|
||||
err(function(){
|
||||
expect({foo: 'bar'}).to.deep.equal({foo: 'baz'}, 'blah');
|
||||
}, "blah: expected { foo: 'bar' } to deeply equal { foo: 'baz' }");
|
||||
|
||||
err(function(){
|
||||
expect({foo: 'bar'}, 'blah').to.deep.equal({foo: 'baz'});
|
||||
}, "blah: expected { foo: 'bar' } to deeply equal { foo: 'baz' }");
|
||||
|
||||
err(function(){
|
||||
expect({foo: 'bar'}).to.not.deep.equal({foo: 'bar'}, 'blah');
|
||||
}, "blah: expected { foo: 'bar' } to not deeply equal { foo: 'bar' }");
|
||||
|
||||
err(function(){
|
||||
expect({foo: 'bar'}, 'blah').to.not.deep.equal({foo: 'bar'});
|
||||
}, "blah: expected { foo: 'bar' } to not deeply equal { foo: 'bar' }");
|
||||
});
|
||||
|
||||
it('deep.equal(/regexp/)', function(){
|
||||
|
|
|
@ -1022,6 +1022,19 @@ describe('should', function() {
|
|||
}, "blah: expected '4' to equal 4");
|
||||
});
|
||||
|
||||
it('deep.equal(val)', function(){
|
||||
({ foo: 'bar' }).should.deep.equal({ foo: 'bar' });
|
||||
({ foo: 'bar' }).should.not.deep.equal({ foo: 'baz' });
|
||||
|
||||
err(function(){
|
||||
({foo: 'bar'}).should.deep.equal({foo: 'baz'}, 'blah');
|
||||
}, "blah: expected { foo: 'bar' } to deeply equal { foo: 'baz' }");
|
||||
|
||||
err(function(){
|
||||
({foo: 'bar'}).should.not.deep.equal({foo: 'bar'}, 'blah');
|
||||
}, "blah: expected { foo: 'bar' } to not deeply equal { foo: 'bar' }");
|
||||
});
|
||||
|
||||
it('empty', function(){
|
||||
function FakeArgs() {};
|
||||
FakeArgs.prototype.length = 0;
|
||||
|
|
Loading…
Reference in a new issue