node/test/parallel/test-fs-rmdir-throws-not-found.js
James M Snell eec0302088
fs: move rmdir recursive option to end-of-life
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>
2025-06-21 16:20:38 +00:00

34 lines
581 B
JavaScript

'use strict';
const common = require('../common');
const tmpdir = require('../common/tmpdir');
const assert = require('assert');
const fs = require('fs');
tmpdir.refresh();
{
assert.throws(
() =>
fs.rmdirSync(tmpdir.resolve('noexist.txt')),
{
code: 'ENOENT',
}
);
}
{
fs.rmdir(
tmpdir.resolve('noexist.txt'),
common.mustCall((err) => {
assert.strictEqual(err.code, 'ENOENT');
})
);
}
{
assert.rejects(
() => fs.promises.rmdir(tmpdir.resolve('noexist.txt')),
{
code: 'ENOENT',
}
).then(common.mustCall());
}