This PR addresses failing tests in test/fileFactory.spec.js. These tests were failing because an fsWriteStream was emitting both an error event and a close event that caused the callback to fire twice.
However, this only happened when using a the callback interface to file.mv, as the promise interface would naturally "eat" the second event. In order to both fix the tests, and ensure that both promises and callbacks behave the same way to the user, this PR adjusts the behavior of the promiseCallback wrapper function to prevent duplicate callbacks.
This PR addresses failing tests in
test/fileFactory.spec.js
. These tests were failing because anfsWriteStream
was emitting both anerror
event and aclose
event that caused the callback to fire twice.However, this only happened when using a the callback interface to
file.mv
, as the promise interface would naturally "eat" the second event. In order to both fix the tests, and ensure that both promises and callbacks behave the same way to the user, this PR adjusts the behavior of thepromiseCallback
wrapper function to prevent duplicate callbacks.