Skip to content

Commit b21bbac

Browse files
test: keep touching an unseen directory instead of reading it
A file created in a missing directory is tracked as that directory, which readFileSync rejects with EISDIR inside the retry timer.
1 parent 2cdba95 commit b21bbac

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎test/templates/WatchTestCases.js‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,13 @@ const describeCases = (config) => {
383383
}
384384
// macOS can drop a change event entirely, and a timestamp-only
385385
// touch can go unseen too for a re-created file, so rewrite it
386+
const now = new Date();
386387
for (const file of unseenChanges) {
387-
if (fs.existsSync(file)) {
388+
if (!fs.existsSync(file)) continue;
389+
// a directory stands for a file created in a missing one
390+
if (fs.statSync(file).isDirectory()) {
391+
fs.utimesSync(file, now, now);
392+
} else {
388393
fs.writeFileSync(file, fs.readFileSync(file));
389394
}
390395
}

0 commit comments

Comments
 (0)