Browse Source

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 <princejohnwesley@gmail.com>
Reviewed-By: Yorkie Liu <yorkiefixer@gmail.com>
Reviewed-By: JacksonTian - Jackson Tian <shvyo1987@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
v4.x
Rich Trott 9 years ago
committed by Myles Borins
parent
commit
ce2cfbdc3a
  1. 5
      test/parallel/test-console-instance.js

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

Loading…
Cancel
Save