fs: preserve filename when recursive watch root file is removed by cuishuang · Pull Request #65882 · nodejs/node · GitHub
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/internal/fs/recursive_watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,10 @@ function watchUntil(target, done) {
}

{
// So is removing a watched root that is a file (with an empty filename,
// as before).
// Removing a watched root that is a file is reported.
const lone = tmpdir.resolve('lone.txt');
fs.writeFileSync(lone, 'x');
const events = watchUntil(lone, (seen) => seen.includes('rename '));
const events = watchUntil(lone, (seen) => seen.includes('rename lone.txt'));
await delay();
fs.rmSync(lone);
await events;
Expand Down
34 changes: 34 additions & 0 deletions test/parallel/test-fs-watch-recursive-root-file.js
Loading