diff --git a/lib/fs.js b/lib/fs.js index f0ad82cfb1..9a6eaa9b08 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -2000,7 +2000,8 @@ SyncWriteStream.prototype.destroy = function() { SyncWriteStream.prototype.destroySoon = SyncWriteStream.prototype.destroy; -fs.mkdtemp = function(prefix, options, callback) { +fs.mkdtemp = function(prefix, options, callback_) { + var callback = maybeCallback(callback_); if (!prefix || typeof prefix !== 'string') throw new TypeError('filename prefix is required'); diff --git a/test/parallel/test-fs-mkdtemp.js b/test/parallel/test-fs-mkdtemp.js index ad8a6cb46e..d3def97fef 100644 --- a/test/parallel/test-fs-mkdtemp.js +++ b/test/parallel/test-fs-mkdtemp.js @@ -25,3 +25,5 @@ fs.mkdtemp( assert(common.fileExists(folder)); }) ); + +assert.doesNotThrow(() => fs.mkdtemp(path.join(common.tmpDir, 'bar-')));