diff --git a/index.js b/index.js index b1e921d..3cd3cb6 100644 --- a/index.js +++ b/index.js @@ -929,10 +929,11 @@ if (a.prototype !== b.prototype) return false; //~~~I've managed to break Object.keys through screwy arguments passing. // Converting to array solves the problem. - if (isArguments(a)) { - if (!isArguments(b)) { - return false; - } + var aIsArgs = isArguments(a), + bIsArgs = isArguments(b); + if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs)) + return false; + if (aIsArgs) { a = pSlice.call(a); b = pSlice.call(b); return expect.eql(a, b); diff --git a/test/expect.js b/test/expect.js index 7b24cdf..c372408 100644 --- a/test/expect.js +++ b/test/expect.js @@ -312,6 +312,14 @@ describe('expect', function () { expect('4').to.eql(4); expect(/a/gmi).to.eql(/a/mig); + err(function() { + expect([]).to.eql(arguments); + }, 'expected [] to sort of equal {}'); + + err(function() { + expect(arguments).to.eql([]); + }, 'expected {} to sort of equal []'); + err(function () { expect(4).to.eql(3); }, 'expected 4 to sort of equal 3');