isaacs/node-tap — pull request #22 by jhs (2011-12-05 01:50:30+00:00)
Title: similar() and dissimilar() bug fix when `null` is used

Today `t.throws()` was giving me trouble. This is not the first time. Here is the problem:

var expected = {"name":"MyError", "message":"The message"};
t.throws(function() {
console.log("I do not throw after all!")
}, expected);

Ultimately this is converted to `assert.similar(null, expected)` which calls `selectFields(null, expected)` which... wait for it... throws an exception trying to loop through `null`'.

These patches fix that. The only weird thing is that now `assert.similar()` runs two assertions internally. Not sure if that throws anything off such as the auto-incrementing `id` or whatever. All the tests still pass at least.

P.S. Thanks very much for merging all these into one repository!