mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 12:20:27 +01:00
Test for invalid argument types passed to code on util.deprecate. PR-URL: https://github.com/nodejs/node/pull/16305 Backport-PR-URL: https://github.com/nodejs/node/pull/16430 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>
12 lines
292 B
JavaScript
12 lines
292 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const util = require('util');
|
|
|
|
[1, true, false, null, {}].forEach((notString) => {
|
|
common.expectsError(() => util.deprecate(() => {}, 'message', notString), {
|
|
type: TypeError,
|
|
message: '`code` argument must be a string'
|
|
});
|
|
});
|