From 5d68e4ba9bd5f8f561be158a18e3a370475d7c15 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); +});