Skip to content

watchFile never fires when vfs uses a real dir #64536

Description

@Y1D7NG

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions