test: favor regex over TypeError in assert.throws
There are 2 assert.throws()
that test type-conversions that
intentionally fail. These failing type-conversions throw TypeError
values.
Previously, the 2 assert.throws()
checked if the invalid
type-conversions threw TypeError
values. This was accomplished
by passing the TypeError
constructor as the 2nd argument to
assert.throws()
.
Now, the 2 assert.throws()
check the thrown errors' messages
specifically. This is accomplished by passing a regex as the
2nd argument to assert.throws()
.
This modification conforms to the prescribed format of assertions
detailed in doc/guides/writing-tests.md
.
Refs: https://github.com/nodejs/node/blob/master/doc/guides/writing-tests.md#assertions
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
commit message follows commit guidelines
Affected core subsystem(s)
test/