isaacs/tap-assert — pull request #4 by jhs (2011-11-14 04:13:17+00:00)
Title: Bugfix for similar() and dissimilar() tests with a null argument

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.