nodejs / nodejs/node

watchFile never fires when vfs uses a real dir

Open
#64,536 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
122k
Forks
37.3k
Avg merge
4d 2h
Merged PRs (30d)
283

Description

Version

main

Platform
macOS 26.2
Subsystem

vfs

What steps will reproduce the bug?

test.js:

const vfs = require('node:vfs');
const fs = require('fs');

const v = vfs.create(new vfs.RealFSProvider('/tmp'));

let called = false;
v.watchFile('/a.txt', { interval: 50 }, () => {
  called = true;
});

fs.writeFileSync('/tmp/a.txt', 'x');

setTimeout(() => {
  console.log('called?', called);
}, 300);

$ node --experimental-vfs test.js

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior? Why is that the expected behavior?

called? true

file changed, the listener should run

What do you see instead?

called? false

Additional information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with test.js and the node:vfs entry points for RealFSProvider and watchFile, then reproduce the issue with node --experimental-vfs test.js. Trace why the listener is not invoked after /tmp/a.txt changes; done means the example reports called? true.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.