Arrays are compared as objects and thus extra properties in the array are compared. But the error output doesn't display these extra properties.
You can verify this as follows:
var a = [1,2,3];
a.extra = 4;
Error: Expected [ 1, 2, 3 ] to equal [ 1, 2, 3 ].
In my case, I had a test like expect(a).toEqual([1,2,3]); which was failing, but it took me a while to figure out that the extra properties were the problem because they weren't in the output. Now I have it working like this expect(a.slice()).toEqual([1,2,3]);.
I think that if both values are arrays, they should be compared as arrays only. But if that's not acceptable, at least the output should be changed to include the extra properties.
We're drastically improving the equality function, borrowing heavily from Underscore. The Array compare ignores extra properties. So that suggests we close this issue.
However, this does bring up an interesting question. It sounds like the error reporting is the problem.
I'm adding a story to the backlog to both make the new equality compare properties AFTER length and items match. And that the report should explain the lack of equivalence.
Thanks for this find. It's a lack of backwards-compatibility that I didn't realized we were introducing in our 2.0 work.
Sounds good. Thanks for looking into this.