node/test/parallel/test-util-deprecate-invalid-code.js
Ashish Kaila 55ba1d4115
util: expand test coverage for util.deprecate
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>
2017-10-31 00:15:13 +00:00

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'
});
});