Skip to content

Commit

Permalink
test: console constructor missing new keyword
Browse files Browse the repository at this point in the history
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: nodejs#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>
  • Loading branch information
Trott committed Aug 10, 2016
1 parent 8726a1c commit 4c62892
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/parallel/test-console-instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

0 comments on commit 4c62892

Please sign in to comment.