Skip to content

Commit fe8297c

Browse files
akailaapapirovski
authored andcommitted
util: expand test coverage for util.deprecate
Test for invalid argument types passed to code on util.deprecate. PR-URL: #16305 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent cfea677 commit fe8297c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
'use strict';
2+
3+
const common = require('../common');
4+
const util = require('util');
5+
6+
[1, true, false, null, {}].forEach((notString) => {
7+
common.expectsError(() => util.deprecate(() => {}, 'message', notString), {
8+
code: 'ERR_INVALID_ARG_TYPE',
9+
type: TypeError,
10+
message: 'The "code" argument must be of type string'
11+
});
12+
});

0 commit comments

Comments
 (0)