node-dev
node-dev copied to clipboard
Implement a global change debounce
This changes the debounce timeout to apply globally rather than per-file. This fixes an issue where if various different files were being changed, the process would restart even though the debounce time had not passed.
Fixes https://github.com/fgnass/node-dev/issues/301
Thank you for the PR, could you add a test that ensures the behavior you're trying to fix stays fixed?
could you add a test that ensures the behavior you're trying to fix stays fixed
I'm not opposed to this. Do you have an example of a test already in place I could work from? This seems a bit tricky to test.
The tests in test/spawn
attempt to run the code in test/fixtures
. You could make a fixture that requires two different files then add a test referencing that fixture and make sure the restart only occurs one time.
OK I think figured out a test. At least, if I revert the change the test fails, and with the change it passes.
There seem to be some delays in the change notifications that I don't quite understand. I was seeing an extra second or more delay added on top of the debounce here, so the delays in the test are pretty long to absorb that.