mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
wip
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user