Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fs.rm behaves differently on NodeJS 16 vs 14 #346

Open
yotamselementor opened this issue Dec 19, 2021 · 2 comments
Open

fs.rm behaves differently on NodeJS 16 vs 14 #346

yotamselementor opened this issue Dec 19, 2021 · 2 comments
Assignees

Comments

@yotamselementor
Copy link

The following code behaves differently on NodeJS 16 and NodeJS 14:

            mockFs({
                path: {
                    source: {
                        subdir: mockFs.directory(),
                    },
                },
            });
            await fs.rm("path/source", { force: true });

On NodeJS 14, the code runs successfully, while on NodeJS 16 it fails with the following error: SystemError: Path is a directory: rm returned EISDIR (is a directory) path/source

@3cp
Copy link
Collaborator

3cp commented Dec 19, 2021

fs.rm was just added in nodejs v14.14.0. We never had any test coverage on it.
I can work on it when I got time.

@3cp 3cp self-assigned this Dec 19, 2021
@3cp
Copy link
Collaborator

3cp commented Dec 22, 2021

I tested fs.rm with force:true without mock-fs, nodejs v14.18.1 returns same error as nodejs v17.1.0. You have to use recursive:true for any rm(folder). It's understandable, as fs.rm is modeled on the standard POSIX rm utility (rm -r dir).

(node:46582) UnhandledPromiseRejectionWarning: SystemError [ERR_FS_EISDIR]: Path is a directory: rm returned EISDIR (is a directory) a

What nodejs v14 version were you using?

(I found another issue related to file permission when testing fs.rm with mock-fs, working on it.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants