mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
fe8297ca92
Test for invalid argument types passed to code on util.deprecate. PR-URL: https://github.com/nodejs/node/pull/16305 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
13 lines
336 B
JavaScript
13 lines
336 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const util = require('util');
|
|
|
|
[1, true, false, null, {}].forEach((notString) => {
|
|
common.expectsError(() => util.deprecate(() => {}, 'message', notString), {
|
|
code: 'ERR_INVALID_ARG_TYPE',
|
|
type: TypeError,
|
|
message: 'The "code" argument must be of type string'
|
|
});
|
|
});
|