Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions test/parallel/test-fs-rm.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,19 +185,19 @@ function removeAsync(dir) {
makeNonEmptyDirectory(4, 10, 2, dir, true);

// Removal should fail without the recursive option set to true.
assert.rejects(fs.promises.rm(dir), { syscall: 'rm' });
assert.rejects(fs.promises.rm(dir, { recursive: false }), {
await assert.rejects(fs.promises.rm(dir), { syscall: 'rm' });
await assert.rejects(fs.promises.rm(dir, { recursive: false }), {
syscall: 'rm'
});

// Recursive removal should succeed.
await fs.promises.rm(dir, { recursive: true });

// Attempted removal should fail now because the directory is gone.
assert.rejects(fs.promises.rm(dir), { syscall: 'stat' });
await assert.rejects(fs.promises.rm(dir), { syscall: 'stat' });

// Should fail if target does not exist
assert.rejects(fs.promises.rm(
await assert.rejects(fs.promises.rm(
path.join(tmpdir.path, 'noexist.txt'),
{ recursive: true }
), {
Expand All @@ -207,7 +207,7 @@ function removeAsync(dir) {
});

// Should not fail if target does not exist and force option is true
fs.promises.rm(path.join(tmpdir.path, 'noexist.txt'), { force: true });
await fs.promises.rm(path.join(tmpdir.path, 'noexist.txt'), { force: true });

// Should delete file
const filePath = path.join(tmpdir.path, 'rm-promises-file.txt');
Expand Down
6 changes: 3 additions & 3 deletions test/parallel/test-fs-rmdir-recursive.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ function removeAsync(dir) {
makeNonEmptyDirectory(4, 10, 2, dir, true);

// Removal should fail without the recursive option set to true.
assert.rejects(fs.promises.rmdir(dir), { syscall: 'rmdir' });
assert.rejects(fs.promises.rmdir(dir, { recursive: false }), {
await assert.rejects(fs.promises.rmdir(dir), { syscall: 'rmdir' });
await assert.rejects(fs.promises.rmdir(dir, { recursive: false }), {
syscall: 'rmdir'
});

Expand All @@ -154,7 +154,7 @@ function removeAsync(dir) {
{ code: 'ENOENT' });

// Attempted removal should fail now because the directory is gone.
assert.rejects(fs.promises.rmdir(dir), { syscall: 'rmdir' });
await assert.rejects(fs.promises.rmdir(dir), { syscall: 'rmdir' });
})().then(common.mustCall());

// Test input validation.
Expand Down