mocha/7 - watch.js
function reWriter(goCrazy, filePath, data) {
    /*
    Keep on writing a file until chokidar notices us.
    @param  {Boolean}  goCrazy   Start or continue to write a file every 500 ms until someone stops us!
    @param  {String}   filePath  String file path like '/source/file.txt'. Not used if goCrazy is false.
    @param  {String}   [data]    Optional data to write to the file. Defaults to 'changed data'.
    */
    if (goCrazy) {
        data = data || 'changed data'
        fs.writeFileSync(filePath, data)

        reWriteTimer = setTimeout(function() {
            reWriter(goCrazy, filePath, data)
        }, 500)
    } else {
        clearTimeout(reWriteTimer)
    }
}
function reWriter(goCrazy, filePath, data) {
    /*
    Keep on writing a file until chokidar notices us.
    @param  {Boolean}  goCrazy   Start or continue to write a file every 500 ms until someone stops us!
    @param  {String}   filePath  String file path like '/source/file.txt'. Not used if goCrazy is false.
    @param  {String}   [data]    Optional data to write to the file. Defaults to 'changed data'.
    */
    if (goCrazy) {
        data = data || 'changed data'
        fs.writeFileSync(filePath, data)

        reWriteTimer = setTimeout(function() {
            reWriter(goCrazy, filePath, data)
        }, 500)
    } else {
        clearTimeout(reWriteTimer)
    }
}
----------- Functions -----------