Compare commits

...

1 Commits

Author SHA1 Message Date
Ben Grant
01fa48d505 wip 2025-07-17 13:56:32 -07:00
2 changed files with 17 additions and 0 deletions

View File

@@ -5678,6 +5678,7 @@ pub const NodeFS = struct {
error.InvalidUtf8 => .INVAL,
error.InvalidWtf8 => .INVAL,
error.BadPathName => .INVAL,
error.IsDir => .ISDIR,
error.FileNotFound => brk: {
if (args.force) {
return Maybe(Return.Rm).success;

View File

@@ -1726,6 +1726,22 @@ describe("rm", () => {
expect(existsSync(path)).toBe(false);
});
it.only("returns the right error when removing a dir without recursive", () => {
const path = `${tmpdir()}/${Date.now()}.rm.dir`;
try {
mkdirSync(path);
} catch (e) {}
expect(existsSync(path)).toBe(true);
let error;
try {
rmSync(path, { force: true });
} catch (e) {
error = e;
}
expect(error).toBeInstanceOf(Error);
expect(error.errno).toBe(21);
});
it("removes a dir recursively", () => {
const path = `${tmpdir()}/${Date.now()}.rm.dir/foo/bar`;
try {