From 196142754809f3bd345c9e65cfbe3c66e959b385 Mon Sep 17 00:00:00 2001 From: Paul Miller Date: Thu, 6 Sep 2018 15:09:26 +0300 Subject: [PATCH] Skip #682 tests without commenting-out. --- test.js | 271 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 137 insertions(+), 134 deletions(-) diff --git a/test.js b/test.js index 6c880e98..1109d56a 100644 --- a/test.js +++ b/test.js @@ -658,140 +658,6 @@ function runTests(baseopts) { }); }); - // PR 682. - // it('should detect unlink while watching a non-existent second file in another directory', function(done) { - // var spy = sinon.spy(); - // var testPath = getFixturePath('unlink.txt'); - // var otherDirPath = getFixturePath('other-dir'); - // var otherPath = getFixturePath('other-dir/other.txt'); - // fs.mkdirSync(otherDirPath, PERM_ARR); - // // intentionally for this test don't write fs.writeFileSync(otherPath, 'other'); - // watcher = chokidar.watch([testPath, otherPath], options) - // .on('unlink', spy) - // .on('ready', function() { - // w(fs.unlink.bind(fs, testPath, simpleCb))(); - // waitFor([spy], function() { - // spy.should.have.been.calledWith(testPath); - // done(); - // }); - // }); - // }); - // it('should detect unlink and re-add while watching a second file', function(done) { - // options.ignoreInitial = true; - // var unlinkSpy = sinon.spy(function unlinkSpy(){}); - // var addSpy = sinon.spy(function addSpy(){}); - // var testPath = getFixturePath('unlink.txt'); - // var otherPath = getFixturePath('other.txt'); - // fs.writeFileSync(otherPath, 'other'); - // watcher = chokidar.watch([testPath, otherPath], options) - // .on('unlink', unlinkSpy) - // .on('add', addSpy) - // .on('ready', function() { - // w(fs.unlink.bind(fs, testPath, simpleCb))(); - // waitFor([unlinkSpy], w(function() { - // unlinkSpy.should.have.been.calledWith(testPath); - // w(fs.writeFile.bind(fs, testPath, 're-added', simpleCb))(); - // waitFor([addSpy], function() { - // addSpy.should.have.been.calledWith(testPath); - // done(); - // }); - // })); - // }); - // }); - // it('should detect unlink and re-add while watching a non-existent second file in another directory', function(done) { - // options.ignoreInitial = true; - // var unlinkSpy = sinon.spy(function unlinkSpy(){}); - // var addSpy = sinon.spy(function addSpy(){}); - // var testPath = getFixturePath('unlink.txt'); - // var otherDirPath = getFixturePath('other-dir'); - // var otherPath = getFixturePath('other-dir/other.txt'); - // fs.mkdirSync(otherDirPath, PERM_ARR); - // // intentionally for this test don't write fs.writeFileSync(otherPath, 'other'); - // watcher = chokidar.watch([testPath, otherPath], options) - // .on('unlink', unlinkSpy) - // .on('add', addSpy) - // .on('ready', function() { - // w(fs.unlink.bind(fs, testPath, simpleCb))(); - // waitFor([unlinkSpy], w(function() { - // unlinkSpy.should.have.been.calledWith(testPath); - // w(fs.writeFile.bind(fs, testPath, 're-added', simpleCb))(); - // waitFor([addSpy], function() { - // addSpy.should.have.been.calledWith(testPath); - // done(); - // }); - // })); - // }); - // }); - // it('should detect unlink and re-add while watching a non-existent second file in the same directory', function(done) { - // options.ignoreInitial = true; - // var unlinkSpy = sinon.spy(function unlinkSpy(){}); - // var addSpy = sinon.spy(function addSpy(){}); - // var testPath = getFixturePath('unlink.txt'); - // var otherPath = getFixturePath('other.txt'); - // // intentionally for this test don't write fs.writeFileSync(otherPath, 'other'); - // watcher = chokidar.watch([testPath, otherPath], options) - // .on('unlink', unlinkSpy) - // .on('add', addSpy) - // .on('ready', function() { - // w(fs.unlink.bind(fs, testPath, simpleCb))(); - // waitFor([unlinkSpy], w(function() { - // unlinkSpy.should.have.been.calledWith(testPath); - // w(fs.writeFile.bind(fs, testPath, 're-added', simpleCb))(); - // waitFor([addSpy], function() { - // addSpy.should.have.been.calledWith(testPath); - // done(); - // }); - // })); - // }); - // }); - // it('should detect two unlinks and one re-add', function(done) { - // options.ignoreInitial = true; - // var unlinkSpy = sinon.spy(function unlinkSpy(){}); - // var addSpy = sinon.spy(function addSpy(){}); - // var testPath = getFixturePath('unlink.txt'); - // var otherPath = getFixturePath('other.txt'); - // fs.writeFileSync(otherPath, 'other'); - // watcher = chokidar.watch([testPath, otherPath], options) - // .on('unlink', unlinkSpy) - // .on('add', addSpy) - // .on('ready', function() { - // w(fs.unlink.bind(fs, otherPath, simpleCb))(); - // w(fs.unlink.bind(fs, testPath, simpleCb))(); - // waitFor([[unlinkSpy, 2]], w(function() { - // unlinkSpy.should.have.been.calledWith(otherPath); - // unlinkSpy.should.have.been.calledWith(testPath); - // w(fs.writeFile.bind(fs, testPath, 're-added', simpleCb))(); - // waitFor([addSpy], function() { - // addSpy.should.have.been.calledWith(testPath); - // done(); - // }); - // })); - // }); - // }); - // it('should detect unlink and re-add while watching a second file and a non-existent third file', function(done) { - // options.ignoreInitial = true; - // var unlinkSpy = sinon.spy(function unlinkSpy(){}); - // var addSpy = sinon.spy(function addSpy(){}); - // var testPath = getFixturePath('unlink.txt'); - // var otherPath = getFixturePath('other.txt'); - // var other2Path = getFixturePath('other2.txt'); - // fs.writeFileSync(otherPath, 'other'); - // // intentionally for this test don't write fs.writeFileSync(other2Path, 'other2'); - // watcher = chokidar.watch([testPath, otherPath, other2Path], options) - // .on('unlink', unlinkSpy) - // .on('add', addSpy) - // .on('ready', function() { - // w(fs.unlink.bind(fs, testPath, simpleCb))(); - // waitFor([unlinkSpy], w(function() { - // unlinkSpy.should.have.been.calledWith(testPath); - // w(fs.writeFile.bind(fs, testPath, 're-added', simpleCb))(); - // waitFor([addSpy], function() { - // addSpy.should.have.been.calledWith(testPath); - // done(); - // }); - // })); - // }); - // }); it('should ignore unwatched siblings', function(done) { var spy = sinon.spy(); var testPath = getFixturePath('add.txt'); @@ -807,6 +673,143 @@ function runTests(baseopts) { }); })); }); + + // PR 682 is failing. + describe.skip('Skipping gh-682: should detect unlink', function() { + it('should detect unlink while watching a non-existent second file in another directory', function(done) { + var spy = sinon.spy(); + var testPath = getFixturePath('unlink.txt'); + var otherDirPath = getFixturePath('other-dir'); + var otherPath = getFixturePath('other-dir/other.txt'); + fs.mkdirSync(otherDirPath, PERM_ARR); + // intentionally for this test don't write fs.writeFileSync(otherPath, 'other'); + watcher = chokidar.watch([testPath, otherPath], options) + .on('unlink', spy) + .on('ready', function() { + w(fs.unlink.bind(fs, testPath, simpleCb))(); + waitFor([spy], function() { + spy.should.have.been.calledWith(testPath); + done(); + }); + }); + }); + it('should detect unlink and re-add while watching a second file', function(done) { + options.ignoreInitial = true; + var unlinkSpy = sinon.spy(function unlinkSpy(){}); + var addSpy = sinon.spy(function addSpy(){}); + var testPath = getFixturePath('unlink.txt'); + var otherPath = getFixturePath('other.txt'); + fs.writeFileSync(otherPath, 'other'); + watcher = chokidar.watch([testPath, otherPath], options) + .on('unlink', unlinkSpy) + .on('add', addSpy) + .on('ready', function() { + w(fs.unlink.bind(fs, testPath, simpleCb))(); + waitFor([unlinkSpy], w(function() { + unlinkSpy.should.have.been.calledWith(testPath); + w(fs.writeFile.bind(fs, testPath, 're-added', simpleCb))(); + waitFor([addSpy], function() { + addSpy.should.have.been.calledWith(testPath); + done(); + }); + })); + }); + }); + it('should detect unlink and re-add while watching a non-existent second file in another directory', function(done) { + options.ignoreInitial = true; + var unlinkSpy = sinon.spy(function unlinkSpy(){}); + var addSpy = sinon.spy(function addSpy(){}); + var testPath = getFixturePath('unlink.txt'); + var otherDirPath = getFixturePath('other-dir'); + var otherPath = getFixturePath('other-dir/other.txt'); + fs.mkdirSync(otherDirPath, PERM_ARR); + // intentionally for this test don't write fs.writeFileSync(otherPath, 'other'); + watcher = chokidar.watch([testPath, otherPath], options) + .on('unlink', unlinkSpy) + .on('add', addSpy) + .on('ready', function() { + w(fs.unlink.bind(fs, testPath, simpleCb))(); + waitFor([unlinkSpy], w(function() { + unlinkSpy.should.have.been.calledWith(testPath); + w(fs.writeFile.bind(fs, testPath, 're-added', simpleCb))(); + waitFor([addSpy], function() { + addSpy.should.have.been.calledWith(testPath); + done(); + }); + })); + }); + }); + it('should detect unlink and re-add while watching a non-existent second file in the same directory', function(done) { + options.ignoreInitial = true; + var unlinkSpy = sinon.spy(function unlinkSpy(){}); + var addSpy = sinon.spy(function addSpy(){}); + var testPath = getFixturePath('unlink.txt'); + var otherPath = getFixturePath('other.txt'); + // intentionally for this test don't write fs.writeFileSync(otherPath, 'other'); + watcher = chokidar.watch([testPath, otherPath], options) + .on('unlink', unlinkSpy) + .on('add', addSpy) + .on('ready', function() { + w(fs.unlink.bind(fs, testPath, simpleCb))(); + waitFor([unlinkSpy], w(function() { + unlinkSpy.should.have.been.calledWith(testPath); + w(fs.writeFile.bind(fs, testPath, 're-added', simpleCb))(); + waitFor([addSpy], function() { + addSpy.should.have.been.calledWith(testPath); + done(); + }); + })); + }); + }); + it('should detect two unlinks and one re-add', function(done) { + options.ignoreInitial = true; + var unlinkSpy = sinon.spy(function unlinkSpy(){}); + var addSpy = sinon.spy(function addSpy(){}); + var testPath = getFixturePath('unlink.txt'); + var otherPath = getFixturePath('other.txt'); + fs.writeFileSync(otherPath, 'other'); + watcher = chokidar.watch([testPath, otherPath], options) + .on('unlink', unlinkSpy) + .on('add', addSpy) + .on('ready', function() { + w(fs.unlink.bind(fs, otherPath, simpleCb))(); + w(fs.unlink.bind(fs, testPath, simpleCb))(); + waitFor([[unlinkSpy, 2]], w(function() { + unlinkSpy.should.have.been.calledWith(otherPath); + unlinkSpy.should.have.been.calledWith(testPath); + w(fs.writeFile.bind(fs, testPath, 're-added', simpleCb))(); + waitFor([addSpy], function() { + addSpy.should.have.been.calledWith(testPath); + done(); + }); + })); + }); + }); + it('should detect unlink and re-add while watching a second file and a non-existent third file', function(done) { + options.ignoreInitial = true; + var unlinkSpy = sinon.spy(function unlinkSpy(){}); + var addSpy = sinon.spy(function addSpy(){}); + var testPath = getFixturePath('unlink.txt'); + var otherPath = getFixturePath('other.txt'); + var other2Path = getFixturePath('other2.txt'); + fs.writeFileSync(otherPath, 'other'); + // intentionally for this test don't write fs.writeFileSync(other2Path, 'other2'); + watcher = chokidar.watch([testPath, otherPath, other2Path], options) + .on('unlink', unlinkSpy) + .on('add', addSpy) + .on('ready', function() { + w(fs.unlink.bind(fs, testPath, simpleCb))(); + waitFor([unlinkSpy], w(function() { + unlinkSpy.should.have.been.calledWith(testPath); + w(fs.writeFile.bind(fs, testPath, 're-added', simpleCb))(); + waitFor([addSpy], function() { + addSpy.should.have.been.calledWith(testPath); + done(); + }); + })); + }); + }); + }); }); describe('renamed directory', function() { it('should emit `add` for a file in a renamed directory', function(done) {