Skip to content

Commit 1fce8fd

Browse files
Handled an ENOENT error that can occur if the .tmp directory doesn't exist
1 parent f269049 commit 1fce8fd

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

test/fixtures/mocha-hooks.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,15 @@ const paths = require("../utils/paths");
77
* Re-create the .tmp directories before each test
88
*/
99
beforeEach("clean the .tmp directory", async () => {
10-
// Delete the .tmp directory, if it exists
11-
await fs.rmdir(paths.tmp, { recursive: true });
10+
try {
11+
// Delete the .tmp directory, if it exists
12+
await fs.rmdir(paths.tmp, { recursive: true });
13+
}
14+
catch (error) {
15+
if (error.code !== "ENOENT") {
16+
throw error;
17+
}
18+
}
1219

1320
// Create the home and workspace directories
1421
await fs.mkdir(paths.home, { recursive: true });

0 commit comments

Comments
 (0)