Skip to content

Commit f16eca4

Browse files
mithunsasidharanMylesBorins
authored andcommitted
test: improve coverage for util.promisify
Add a test that confirms that non-function arguments passed to util.promisify throw an ERR_INVALID_ARG_TYPE error. PR-URL: #17591 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Jon Moss <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]>
1 parent 7008719 commit f16eca4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/parallel/test-util-promisify.js

+10
Original file line numberDiff line numberDiff line change
@@ -184,3 +184,13 @@ const stat = promisify(fs.stat);
184184
})
185185
]);
186186
}
187+
188+
[undefined, null, true, 0, 'str', {}, [], Symbol()].forEach((input) => {
189+
common.expectsError(
190+
() => promisify(input),
191+
{
192+
code: 'ERR_INVALID_ARG_TYPE',
193+
type: TypeError,
194+
message: 'The "original" argument must be of type Function'
195+
});
196+
});

0 commit comments

Comments
 (0)