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