Skip to content

Commit

Permalink
ready call # is unfortunately platform specific
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Sep 6, 2023
1 parent 1370123 commit f022fe7
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -469,17 +469,6 @@ const runTests = (baseopts) => {
unlinkSpy.withArgs(newPath1).should.have.been.calledOnce;
unlinkSpy.withArgs(newPath2).should.not.have.been.called;
});
it('should emit `ready` when three files were added', async () => {
const path1 = getFixturePath('add1.txt');
const path2 = getFixturePath('add2.txt');
const path3 = getFixturePath('add3.txt');

watcher.add(path1);
watcher.add(path2);
watcher.add(path3);

await waitForWatcher(watcher);
});
it('should survive ENOENT for missing subdirectories', async () => {
const testDir = getFixturePath('notadir');
await waitForWatcher(watcher);
Expand Down Expand Up @@ -560,6 +549,21 @@ const runTests = (baseopts) => {
});
});
describe('watch individual files', () => {
it('should emit `ready` when three files were added', async () => {
const readySpy = sinon.spy(function readySpy(){});
const watcher = chokidar_watch().on(EV_READY, readySpy);
const path1 = getFixturePath('add1.txt');
const path2 = getFixturePath('add2.txt');
const path3 = getFixturePath('add3.txt');

watcher.add(path1);
watcher.add(path2);
watcher.add(path3);

await waitForWatcher(watcher);
// callCount is 1 on macOS, 4 on Ubuntu
readySpy.callCount.should.be.greaterThanOrEqual(1);
});
it('should detect changes', async () => {
const testPath = getFixturePath('change.txt');
const watcher = chokidar_watch(testPath, options);
Expand Down

0 comments on commit f022fe7

Please sign in to comment.