Open yotamselementor opened 2 years ago
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.
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.)
The following code behaves differently on NodeJS 16 and NodeJS 14:
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