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>
v7.x
Rich Trott 9 years ago
parent
commit
4c62892a4b
  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