I was amused to see this passing after I left a comma out:
test("foo", t => {
t.deepEqual(
[1,2] // <-- notice a comma is missing after "]"
[3]
);
t.end();
});
[3] becomes a property lookup for [1,2], returning undefined
t.deepEqual(undefined) is true.
__Proposing:__ t.deepEqual (et al) should fail if only one arg is passed.
whoa wtf
That's delightful, but if anyone was relying on the implicit undefined there, it'd be a breaking change. I'd be happy to make that change whenever we're doing a major otherwise, but I don't think it's worth it to do one just for that.
if(arguments.length < 2) throw 'one of those missing commas amirite?'
Since node's assert does this check, we can too in v5.
Most helpful comment