Skip to content

Commit ba3bcbb

Browse files
Joshua T CorbinJames Halliday
Joshua T Corbin
authored and
James Halliday
committed
Fix Test constructor so that it doesn't accidentally mutate global scope
As used by Test.skip itself circa lib/test.js:464
1 parent 1ca29e2 commit ba3bcbb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/test.js

+4
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ var getTestArgs = function (name_, opts_, cb_) {
3636
};
3737

3838
function Test (name_, opts_, cb_) {
39+
if (! (this instanceof Test)) {
40+
return new Test(name_, opts_, cb_);
41+
}
42+
3943
var args = getTestArgs(name_, opts_, cb_);
4044

4145
this.readable = true;

0 commit comments

Comments
 (0)