From 4c62892a4b0ee521a8b55c775d5f890b5f9d50bf Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 6 Aug 2016 21:52:23 -0700 Subject: [PATCH] test: console constructor missing new keyword The `console.Console()` constructor function handles a missing `new` keyword. This code is not exercised in the current tests. Add a test for this. PR-URL: https://github.com/nodejs/node/pull/8003 Reviewed-By: Prince John Wesley Reviewed-By: Yorkie Liu Reviewed-By: JacksonTian - Jackson Tian Reviewed-By: Colin Ihrig --- test/parallel/test-console-instance.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/parallel/test-console-instance.js b/test/parallel/test-console-instance.js index 2a8a6e3678f58a..b8d9880865530b 100644 --- a/test/parallel/test-console-instance.js +++ b/test/parallel/test-console-instance.js @@ -64,3 +64,8 @@ out.write = function(d) { }; [1, 2, 3].forEach(c.log); assert.equal(3, called); + +// Console() detects if it is called without `new` keyword +assert.doesNotThrow(function() { + Console(out, err); +});