From e8aec5822210403de0a3d189649213da4bb84285 Mon Sep 17 00:00:00 2001 From: Ryan Graham Date: Fri, 8 Aug 2014 18:15:00 -0700 Subject: [PATCH] test: add test for instanceof ctor guard --- test/ctor.test.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/ctor.test.js b/test/ctor.test.js index a09749d..ce6f36d 100644 --- a/test/ctor.test.js +++ b/test/ctor.test.js @@ -53,6 +53,14 @@ test('ensure Logger creation options', function (t) { }); +test('ensure Logger constructor is safe without new', function (t) { + t.doesNotThrow(function () { Logger({name: 'foo'}); }, + 'constructor should call self with new if necessary'); + + t.end(); +}); + + test('ensure Logger creation options (createLogger)', function (t) { t.throws(function () { bunyan.createLogger(); }, 'options (object) is required',