Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9e7cfbb

Browse filesBrowse files
bencoe@google.comdanielleadams
authored andcommitted
test: add missing await in fs-rm/fs-rmdir tests
Noticed that a few assertions were not being awaited, this could potentially be leading to flakiness in tmp cleanup. Refs: #41201 PR-URL: #41545 Refs: #41201 Reviewed-By: Ian Sutherland <ian@iansutherland.ca> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com>
1 parent 82042d0 commit 9e7cfbb
Copy full SHA for 9e7cfbb

File tree

Expand file treeCollapse file tree

2 files changed

+8
-8
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+8
-8
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-fs-rm.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-fs-rm.js
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,19 +184,19 @@ function removeAsync(dir) {
184184
makeNonEmptyDirectory(4, 10, 2, dir, true);
185185

186186
// Removal should fail without the recursive option set to true.
187-
assert.rejects(fs.promises.rm(dir), { syscall: 'rm' });
188-
assert.rejects(fs.promises.rm(dir, { recursive: false }), {
187+
await assert.rejects(fs.promises.rm(dir), { syscall: 'rm' });
188+
await assert.rejects(fs.promises.rm(dir, { recursive: false }), {
189189
syscall: 'rm'
190190
});
191191

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

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

198198
// Should fail if target does not exist
199-
assert.rejects(fs.promises.rm(
199+
await assert.rejects(fs.promises.rm(
200200
path.join(tmpdir.path, 'noexist.txt'),
201201
{ recursive: true }
202202
), {
@@ -206,7 +206,7 @@ function removeAsync(dir) {
206206
});
207207

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

211211
// Should delete file
212212
const filePath = path.join(tmpdir.path, 'rm-promises-file.txt');
Collapse file

‎test/parallel/test-fs-rmdir-recursive.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-fs-rmdir-recursive.js
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ function removeAsync(dir) {
141141
makeNonEmptyDirectory(4, 10, 2, dir, true);
142142

143143
// Removal should fail without the recursive option set to true.
144-
assert.rejects(fs.promises.rmdir(dir), { syscall: 'rmdir' });
145-
assert.rejects(fs.promises.rmdir(dir, { recursive: false }), {
144+
await assert.rejects(fs.promises.rmdir(dir), { syscall: 'rmdir' });
145+
await assert.rejects(fs.promises.rmdir(dir, { recursive: false }), {
146146
syscall: 'rmdir'
147147
});
148148

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

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

160160
// Test input validation.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.