Previously the this._readyCount will be doubled whenever watcher.add() is called, I believe it should have been only doubling the ready count change (hence adding the paths.length again) rather than the total counts. After all, calling watcher.add() for three times should yield the same readyCount as calling it one time with all 3 different paths.
I added a test for this fix. The test hangs forever on macOS because readyCount is too large. With the new fix, the ready event is emitted as expected.
This PR fixes
readyCount
logic.Previously the
this._readyCount
will be doubled wheneverwatcher.add()
is called, I believe it should have been only doubling the ready count change (hence adding thepaths.length
again) rather than the total counts. After all, callingwatcher.add()
for three times should yield the samereadyCount
as calling it one time with all 3 different paths.I added a test for this fix. The test hangs forever on macOS because
readyCount
is too large. With the new fix, theready
event is emitted as expected.