mirror of
https://github.com/nodejs/node.git
synced 2025-05-08 06:36:38 +00:00

This reverts commit 8250bfd1e5
.
PR-URL: https://github.com/nodejs/node/pull/18668
Refs: https://github.com/nodejs/node/pull/12562
Refs: https://github.com/nodejs/node/pull/12976
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
28 lines
664 B
JavaScript
28 lines
664 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const fs = require('fs');
|
|
const callbackThrowValues = [null, true, false, 0, 1, 'foo', /foo/, [], {}];
|
|
|
|
const { sep } = require('path');
|
|
|
|
const tmpdir = require('../common/tmpdir');
|
|
tmpdir.refresh();
|
|
|
|
function testMakeCallback(cb) {
|
|
return function() {
|
|
// fs.mkdtemp() calls makeCallback() on its third argument
|
|
fs.mkdtemp(`${tmpdir.path}${sep}`, {}, cb);
|
|
};
|
|
}
|
|
|
|
function invalidCallbackThrowsTests() {
|
|
callbackThrowValues.forEach((value) => {
|
|
common.expectsError(testMakeCallback(value), {
|
|
code: 'ERR_INVALID_CALLBACK',
|
|
type: TypeError
|
|
});
|
|
});
|
|
}
|
|
|
|
invalidCallbackThrowsTests();
|