Skip to content

Commit 888d1c1

Browse files
committed
test: cleanup test-util-inherits.js
Replaced constructor with regular expression for assert.throw().
1 parent 200961b commit 888d1c1

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

test/parallel/test-util-inherits.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ assert.strictEqual(e.e(), 'e');
7575
assert.strictEqual(e.constructor, E);
7676

7777
// should throw with invalid arguments
78-
assert.throws(function() { inherits(A, {}); }, TypeError);
79-
assert.throws(function() { inherits(A, null); }, TypeError);
80-
assert.throws(function() { inherits(null, A); }, TypeError);
78+
assert.throws(function() {
79+
inherits(A, {});
80+
}, /^TypeError: The super constructor to "inherits" must have a prototype$/);
81+
assert.throws(function() {
82+
inherits(A, null);
83+
}, /^TypeError: The super constructor to "inherits" must not be null or undefined$/); // eslint-disable-line max-len
84+
assert.throws(function() {
85+
inherits(null, A);
86+
}, /^TypeError: The constructor to "inherits" must not be null or undefined$/);

0 commit comments

Comments
 (0)