trentm/node-bunyan — pull request #159 by rmg (2014-08-09 01:49:41+00:00)
Title: Fix bad constructor guard

Apparently nobody has ever called the `Logger` constructor without `new`. Fortunately I found this while reviewing code, not running code.

The problem is the `!` operator is higher priority than the `instanceof` operator, so the expression `! this instanceof X` is the same as `(!this) instanceof X`, which will always evaluate to false.

While I was adding tests (the instanceof guard is part of the public API, after all) I was having trouble getting my tests to fail properly, even though I was following the same pattern as the other tests. Turns out the other tests were all asserting the exception message incorrectly, so I fixed them too.

I split this into 5 separate commits because I wasn't which way you'd prefer the changes be grouped and it's easier to combine than split after the fact.