From 55ba1d41159dccbcb850073499bb21d845462c4e Mon Sep 17 00:00:00 2001 From: Ashish Kaila Date: Wed, 18 Oct 2017 13:59:48 -0700 Subject: [PATCH] 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 Reviewed-By: Gireesh Punathil Reviewed-By: Luigi Pinca Reviewed-By: James M Snell Reviewed-By: Colin Ihrig --- test/parallel/test-util-deprecate-invalid-code.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 test/parallel/test-util-deprecate-invalid-code.js diff --git a/test/parallel/test-util-deprecate-invalid-code.js b/test/parallel/test-util-deprecate-invalid-code.js new file mode 100644 index 00000000000000..c96083173c901f --- /dev/null +++ b/test/parallel/test-util-deprecate-invalid-code.js @@ -0,0 +1,11 @@ +'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' + }); +});