Skip to content

Commit 1961427

Browse files
committed
Skip #682 tests without commenting-out.
1 parent a30eccf commit 1961427

1 file changed

Lines changed: 137 additions & 134 deletions

File tree

test.js

Lines changed: 137 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -658,140 +658,6 @@ function runTests(baseopts) {
658658
});
659659
});
660660

661-
// PR 682.
662-
// it('should detect unlink while watching a non-existent second file in another directory', function(done) {
663-
// var spy = sinon.spy();
664-
// var testPath = getFixturePath('unlink.txt');
665-
// var otherDirPath = getFixturePath('other-dir');
666-
// var otherPath = getFixturePath('other-dir/other.txt');
667-
// fs.mkdirSync(otherDirPath, PERM_ARR);
668-
// // intentionally for this test don't write fs.writeFileSync(otherPath, 'other');
669-
// watcher = chokidar.watch([testPath, otherPath], options)
670-
// .on('unlink', spy)
671-
// .on('ready', function() {
672-
// w(fs.unlink.bind(fs, testPath, simpleCb))();
673-
// waitFor([spy], function() {
674-
// spy.should.have.been.calledWith(testPath);
675-
// done();
676-
// });
677-
// });
678-
// });
679-
// it('should detect unlink and re-add while watching a second file', function(done) {
680-
// options.ignoreInitial = true;
681-
// var unlinkSpy = sinon.spy(function unlinkSpy(){});
682-
// var addSpy = sinon.spy(function addSpy(){});
683-
// var testPath = getFixturePath('unlink.txt');
684-
// var otherPath = getFixturePath('other.txt');
685-
// fs.writeFileSync(otherPath, 'other');
686-
// watcher = chokidar.watch([testPath, otherPath], options)
687-
// .on('unlink', unlinkSpy)
688-
// .on('add', addSpy)
689-
// .on('ready', function() {
690-
// w(fs.unlink.bind(fs, testPath, simpleCb))();
691-
// waitFor([unlinkSpy], w(function() {
692-
// unlinkSpy.should.have.been.calledWith(testPath);
693-
// w(fs.writeFile.bind(fs, testPath, 're-added', simpleCb))();
694-
// waitFor([addSpy], function() {
695-
// addSpy.should.have.been.calledWith(testPath);
696-
// done();
697-
// });
698-
// }));
699-
// });
700-
// });
701-
// it('should detect unlink and re-add while watching a non-existent second file in another directory', function(done) {
702-
// options.ignoreInitial = true;
703-
// var unlinkSpy = sinon.spy(function unlinkSpy(){});
704-
// var addSpy = sinon.spy(function addSpy(){});
705-
// var testPath = getFixturePath('unlink.txt');
706-
// var otherDirPath = getFixturePath('other-dir');
707-
// var otherPath = getFixturePath('other-dir/other.txt');
708-
// fs.mkdirSync(otherDirPath, PERM_ARR);
709-
// // intentionally for this test don't write fs.writeFileSync(otherPath, 'other');
710-
// watcher = chokidar.watch([testPath, otherPath], options)
711-
// .on('unlink', unlinkSpy)
712-
// .on('add', addSpy)
713-
// .on('ready', function() {
714-
// w(fs.unlink.bind(fs, testPath, simpleCb))();
715-
// waitFor([unlinkSpy], w(function() {
716-
// unlinkSpy.should.have.been.calledWith(testPath);
717-
// w(fs.writeFile.bind(fs, testPath, 're-added', simpleCb))();
718-
// waitFor([addSpy], function() {
719-
// addSpy.should.have.been.calledWith(testPath);
720-
// done();
721-
// });
722-
// }));
723-
// });
724-
// });
725-
// it('should detect unlink and re-add while watching a non-existent second file in the same directory', function(done) {
726-
// options.ignoreInitial = true;
727-
// var unlinkSpy = sinon.spy(function unlinkSpy(){});
728-
// var addSpy = sinon.spy(function addSpy(){});
729-
// var testPath = getFixturePath('unlink.txt');
730-
// var otherPath = getFixturePath('other.txt');
731-
// // intentionally for this test don't write fs.writeFileSync(otherPath, 'other');
732-
// watcher = chokidar.watch([testPath, otherPath], options)
733-
// .on('unlink', unlinkSpy)
734-
// .on('add', addSpy)
735-
// .on('ready', function() {
736-
// w(fs.unlink.bind(fs, testPath, simpleCb))();
737-
// waitFor([unlinkSpy], w(function() {
738-
// unlinkSpy.should.have.been.calledWith(testPath);
739-
// w(fs.writeFile.bind(fs, testPath, 're-added', simpleCb))();
740-
// waitFor([addSpy], function() {
741-
// addSpy.should.have.been.calledWith(testPath);
742-
// done();
743-
// });
744-
// }));
745-
// });
746-
// });
747-
// it('should detect two unlinks and one re-add', function(done) {
748-
// options.ignoreInitial = true;
749-
// var unlinkSpy = sinon.spy(function unlinkSpy(){});
750-
// var addSpy = sinon.spy(function addSpy(){});
751-
// var testPath = getFixturePath('unlink.txt');
752-
// var otherPath = getFixturePath('other.txt');
753-
// fs.writeFileSync(otherPath, 'other');
754-
// watcher = chokidar.watch([testPath, otherPath], options)
755-
// .on('unlink', unlinkSpy)
756-
// .on('add', addSpy)
757-
// .on('ready', function() {
758-
// w(fs.unlink.bind(fs, otherPath, simpleCb))();
759-
// w(fs.unlink.bind(fs, testPath, simpleCb))();
760-
// waitFor([[unlinkSpy, 2]], w(function() {
761-
// unlinkSpy.should.have.been.calledWith(otherPath);
762-
// unlinkSpy.should.have.been.calledWith(testPath);
763-
// w(fs.writeFile.bind(fs, testPath, 're-added', simpleCb))();
764-
// waitFor([addSpy], function() {
765-
// addSpy.should.have.been.calledWith(testPath);
766-
// done();
767-
// });
768-
// }));
769-
// });
770-
// });
771-
// it('should detect unlink and re-add while watching a second file and a non-existent third file', function(done) {
772-
// options.ignoreInitial = true;
773-
// var unlinkSpy = sinon.spy(function unlinkSpy(){});
774-
// var addSpy = sinon.spy(function addSpy(){});
775-
// var testPath = getFixturePath('unlink.txt');
776-
// var otherPath = getFixturePath('other.txt');
777-
// var other2Path = getFixturePath('other2.txt');
778-
// fs.writeFileSync(otherPath, 'other');
779-
// // intentionally for this test don't write fs.writeFileSync(other2Path, 'other2');
780-
// watcher = chokidar.watch([testPath, otherPath, other2Path], options)
781-
// .on('unlink', unlinkSpy)
782-
// .on('add', addSpy)
783-
// .on('ready', function() {
784-
// w(fs.unlink.bind(fs, testPath, simpleCb))();
785-
// waitFor([unlinkSpy], w(function() {
786-
// unlinkSpy.should.have.been.calledWith(testPath);
787-
// w(fs.writeFile.bind(fs, testPath, 're-added', simpleCb))();
788-
// waitFor([addSpy], function() {
789-
// addSpy.should.have.been.calledWith(testPath);
790-
// done();
791-
// });
792-
// }));
793-
// });
794-
// });
795661
it('should ignore unwatched siblings', function(done) {
796662
var spy = sinon.spy();
797663
var testPath = getFixturePath('add.txt');
@@ -807,6 +673,143 @@ function runTests(baseopts) {
807673
});
808674
}));
809675
});
676+
677+
// PR 682 is failing.
678+
describe.skip('Skipping gh-682: should detect unlink', function() {
679+
it('should detect unlink while watching a non-existent second file in another directory', function(done) {
680+
var spy = sinon.spy();
681+
var testPath = getFixturePath('unlink.txt');
682+
var otherDirPath = getFixturePath('other-dir');
683+
var otherPath = getFixturePath('other-dir/other.txt');
684+
fs.mkdirSync(otherDirPath, PERM_ARR);
685+
// intentionally for this test don't write fs.writeFileSync(otherPath, 'other');
686+
watcher = chokidar.watch([testPath, otherPath], options)
687+
.on('unlink', spy)
688+
.on('ready', function() {
689+
w(fs.unlink.bind(fs, testPath, simpleCb))();
690+
waitFor([spy], function() {
691+
spy.should.have.been.calledWith(testPath);
692+
done();
693+
});
694+
});
695+
});
696+
it('should detect unlink and re-add while watching a second file', function(done) {
697+
options.ignoreInitial = true;
698+
var unlinkSpy = sinon.spy(function unlinkSpy(){});
699+
var addSpy = sinon.spy(function addSpy(){});
700+
var testPath = getFixturePath('unlink.txt');
701+
var otherPath = getFixturePath('other.txt');
702+
fs.writeFileSync(otherPath, 'other');
703+
watcher = chokidar.watch([testPath, otherPath], options)
704+
.on('unlink', unlinkSpy)
705+
.on('add', addSpy)
706+
.on('ready', function() {
707+
w(fs.unlink.bind(fs, testPath, simpleCb))();
708+
waitFor([unlinkSpy], w(function() {
709+
unlinkSpy.should.have.been.calledWith(testPath);
710+
w(fs.writeFile.bind(fs, testPath, 're-added', simpleCb))();
711+
waitFor([addSpy], function() {
712+
addSpy.should.have.been.calledWith(testPath);
713+
done();
714+
});
715+
}));
716+
});
717+
});
718+
it('should detect unlink and re-add while watching a non-existent second file in another directory', function(done) {
719+
options.ignoreInitial = true;
720+
var unlinkSpy = sinon.spy(function unlinkSpy(){});
721+
var addSpy = sinon.spy(function addSpy(){});
722+
var testPath = getFixturePath('unlink.txt');
723+
var otherDirPath = getFixturePath('other-dir');
724+
var otherPath = getFixturePath('other-dir/other.txt');
725+
fs.mkdirSync(otherDirPath, PERM_ARR);
726+
// intentionally for this test don't write fs.writeFileSync(otherPath, 'other');
727+
watcher = chokidar.watch([testPath, otherPath], options)
728+
.on('unlink', unlinkSpy)
729+
.on('add', addSpy)
730+
.on('ready', function() {
731+
w(fs.unlink.bind(fs, testPath, simpleCb))();
732+
waitFor([unlinkSpy], w(function() {
733+
unlinkSpy.should.have.been.calledWith(testPath);
734+
w(fs.writeFile.bind(fs, testPath, 're-added', simpleCb))();
735+
waitFor([addSpy], function() {
736+
addSpy.should.have.been.calledWith(testPath);
737+
done();
738+
});
739+
}));
740+
});
741+
});
742+
it('should detect unlink and re-add while watching a non-existent second file in the same directory', function(done) {
743+
options.ignoreInitial = true;
744+
var unlinkSpy = sinon.spy(function unlinkSpy(){});
745+
var addSpy = sinon.spy(function addSpy(){});
746+
var testPath = getFixturePath('unlink.txt');
747+
var otherPath = getFixturePath('other.txt');
748+
// intentionally for this test don't write fs.writeFileSync(otherPath, 'other');
749+
watcher = chokidar.watch([testPath, otherPath], options)
750+
.on('unlink', unlinkSpy)
751+
.on('add', addSpy)
752+
.on('ready', function() {
753+
w(fs.unlink.bind(fs, testPath, simpleCb))();
754+
waitFor([unlinkSpy], w(function() {
755+
unlinkSpy.should.have.been.calledWith(testPath);
756+
w(fs.writeFile.bind(fs, testPath, 're-added', simpleCb))();
757+
waitFor([addSpy], function() {
758+
addSpy.should.have.been.calledWith(testPath);
759+
done();
760+
});
761+
}));
762+
});
763+
});
764+
it('should detect two unlinks and one re-add', function(done) {
765+
options.ignoreInitial = true;
766+
var unlinkSpy = sinon.spy(function unlinkSpy(){});
767+
var addSpy = sinon.spy(function addSpy(){});
768+
var testPath = getFixturePath('unlink.txt');
769+
var otherPath = getFixturePath('other.txt');
770+
fs.writeFileSync(otherPath, 'other');
771+
watcher = chokidar.watch([testPath, otherPath], options)
772+
.on('unlink', unlinkSpy)
773+
.on('add', addSpy)
774+
.on('ready', function() {
775+
w(fs.unlink.bind(fs, otherPath, simpleCb))();
776+
w(fs.unlink.bind(fs, testPath, simpleCb))();
777+
waitFor([[unlinkSpy, 2]], w(function() {
778+
unlinkSpy.should.have.been.calledWith(otherPath);
779+
unlinkSpy.should.have.been.calledWith(testPath);
780+
w(fs.writeFile.bind(fs, testPath, 're-added', simpleCb))();
781+
waitFor([addSpy], function() {
782+
addSpy.should.have.been.calledWith(testPath);
783+
done();
784+
});
785+
}));
786+
});
787+
});
788+
it('should detect unlink and re-add while watching a second file and a non-existent third file', function(done) {
789+
options.ignoreInitial = true;
790+
var unlinkSpy = sinon.spy(function unlinkSpy(){});
791+
var addSpy = sinon.spy(function addSpy(){});
792+
var testPath = getFixturePath('unlink.txt');
793+
var otherPath = getFixturePath('other.txt');
794+
var other2Path = getFixturePath('other2.txt');
795+
fs.writeFileSync(otherPath, 'other');
796+
// intentionally for this test don't write fs.writeFileSync(other2Path, 'other2');
797+
watcher = chokidar.watch([testPath, otherPath, other2Path], options)
798+
.on('unlink', unlinkSpy)
799+
.on('add', addSpy)
800+
.on('ready', function() {
801+
w(fs.unlink.bind(fs, testPath, simpleCb))();
802+
waitFor([unlinkSpy], w(function() {
803+
unlinkSpy.should.have.been.calledWith(testPath);
804+
w(fs.writeFile.bind(fs, testPath, 're-added', simpleCb))();
805+
waitFor([addSpy], function() {
806+
addSpy.should.have.been.calledWith(testPath);
807+
done();
808+
});
809+
}));
810+
});
811+
});
812+
});
810813
});
811814
describe('renamed directory', function() {
812815
it('should emit `add` for a file in a renamed directory', function(done) {

0 commit comments

Comments
 (0)