Skip to content

Commit 98cc1fe

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 <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
1 parent 8f9ea23 commit 98cc1fe

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

test/parallel/test-util-promisify.js

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

0 commit comments

Comments
 (0)