Skip to content

Commit c0bd783

Browse files
committed
fixup! fs: remove permissive rmdir recursive
1 parent 8e1e85e commit c0bd783

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

test/parallel/test-fs-rmdir-recursive-throws-on-file.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,23 @@ const path = require('path');
77

88
tmpdir.refresh();
99

10+
const code = common.isWindows ? 'ENOENT' : 'ENOTDIR';
11+
1012
{
1113
const filePath = path.join(tmpdir.path, 'rmdir-recursive.txt');
1214
fs.writeFileSync(filePath, '');
13-
assert.throws(() => fs.rmdirSync(filePath, { recursive: true }), {
14-
code: 'ENOTDIR',
15-
});
15+
assert.throws(() => fs.rmdirSync(filePath, { recursive: true }), { code });
1616
}
1717
{
1818
const filePath = path.join(tmpdir.path, 'rmdir-recursive.txt');
1919
fs.writeFileSync(filePath, '');
2020
fs.rmdir(filePath, { recursive: true }, common.mustCall((err) => {
21-
assert.strictEqual(err.code, 'ENOTDIR');
21+
assert.strictEqual(err.code, code);
2222
}));
2323
}
2424
{
2525
const filePath = path.join(tmpdir.path, 'rmdir-recursive.txt');
2626
fs.writeFileSync(filePath, '');
27-
assert.rejects(() => fs.promises.rmdir(filePath, { recursive: true }), {
28-
code: 'ENOTDIR',
29-
}).then(common.mustCall());
27+
assert.rejects(() => fs.promises.rmdir(filePath, { recursive: true }),
28+
{ code }).then(common.mustCall());
3029
}

0 commit comments

Comments
 (0)