mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00

Has been runtime deprecated for ~ 5 years now. It's time. PR-URL: https://github.com/nodejs/node/pull/58616 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Dario Piotrowicz <dario.piotrowicz@gmail.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: LiviaMedeiros <livia@cirno.name> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Ethan Arrowood <ethan@arrowood.dev> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
28 lines
774 B
JavaScript
28 lines
774 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const tmpdir = require('../common/tmpdir');
|
|
const assert = require('assert');
|
|
const fs = require('fs');
|
|
|
|
tmpdir.refresh();
|
|
|
|
const code = common.isWindows ? 'ENOENT' : 'ENOTDIR';
|
|
|
|
{
|
|
const filePath = tmpdir.resolve('rmdir-recursive.txt');
|
|
fs.writeFileSync(filePath, '');
|
|
assert.throws(() => fs.rmdirSync(filePath), { code });
|
|
}
|
|
{
|
|
const filePath = tmpdir.resolve('rmdir-recursive.txt');
|
|
fs.writeFileSync(filePath, '');
|
|
fs.rmdir(filePath, common.mustCall((err) => {
|
|
assert.strictEqual(err.code, code);
|
|
}));
|
|
}
|
|
{
|
|
const filePath = tmpdir.resolve('rmdir-recursive.txt');
|
|
fs.writeFileSync(filePath, '');
|
|
assert.rejects(() => fs.promises.rmdir(filePath),
|
|
{ code }).then(common.mustCall());
|
|
}
|