Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save swashcap/b4bbfc8c1dccc0af2e98bebb587954fc to your computer and use it in GitHub Desktop.
Save swashcap/b4bbfc8c1dccc0af2e98bebb587954fc to your computer and use it in GitHub Desktop.
$ npm t
> chokidar@1.7.0 test /Users/creed/Sites/chokidar
> istanbul test node_modules/mocha/bin/_mocha
chokidar
✓ should expose public API methods
fsevents (native extension)
watch a directory
✓ should produce an instance of chokidar.FSWatcher
✓ should expose public API methods
✓ should emit `add` event when file was added (179ms)
✓ should emit `addDir` event when directory was added (175ms)
✓ should emit `change` event when file was changed (118ms)
✓ should emit `unlink` event when file was removed (124ms)
✓ should emit `unlinkDir` event when a directory was removed (117ms)
✓ should emit `unlink` and `add` events when a file is renamed (171ms)
✓ should emit `add`, not `change`, when previously deleted file is re-added (209ms)
✓ should not emit `unlink` for previously moved files (321ms)
✓ should survive ENOENT for missing subdirectories
✓ should notice when a file appears in a new directory (123ms)
✓ should watch removed and re-added directories (1737ms)
watch individual files
✓ should detect changes (118ms)
✓ should detect unlinks (170ms)
✓ should detect unlink and re-add (292ms)
✓ should ignore unwatched siblings (168ms)
renamed directory
✓ should emit `add` for a file in a renamed directory (1020ms)
watch non-existent paths
✓ should watch non-existent file and detect add (173ms)
✓ should watch non-existent dir and detect addDir/add (164ms)
watch glob patterns
✓ should correctly watch and emit based on glob input (172ms)
✓ should respect negated glob patterns (171ms)
✓ should traverse subdirs to match globstar patterns (240ms)
✓ should resolve relative paths with glob patterns (175ms)
✓ should correctly handle conflicting glob patterns (71ms)
✓ should correctly handle intersecting glob patterns (97ms)
✓ should not confuse glob-like filenames with globs (103ms)
✓ should treat glob-like directory names as literal directory names when globbing is disabled (100ms)
✓ should treat glob-like filenames as literal filenames when globbing is disabled (96ms)
✓ should not prematurely filter dirs against complex globstar patterns (99ms)
✓ should emit matching dir events (204ms)
watch symlinks
✓ should watch symlinked dirs
✓ should watch symlinked files (120ms)
✓ should follow symlinked files within a normal dir (112ms)
✓ should watch paths with a symlinked parent (114ms)
✓ should not recurse indefinitely on circular symlinks
✓ should recognize changes following symlinked dirs (118ms)
✓ should follow newly created symlinks (122ms)
✓ should watch symlinks as files when followSymlinks:false
✓ should watch symlinks within a watched dir as files when followSymlinks:false (114ms)
✓ should not reuse watcher when following a symlink to elsewhere (121ms)
✓ should properly match glob patterns that include a symlinked dir (118ms)
watch arrays of paths/globs
✓ should watch all paths in an array (113ms)
✓ should accommodate nested arrays in input (116ms)
✓ should throw if provided any non-string paths
watch options
ignoreInitial
false
✓ should emit `add` events for preexisting files
✓ should emit `addDir` event for watched dir
✓ should emit `addDir` events for preexisting dirs
true
✓ should ignore inital add events (52ms)
✓ should ignore add events on a subsequent .add() (1002ms)
✓ should notice when a file appears in an empty directory (119ms)
✓ should emit a change on a preexisting file as a change (120ms)
✓ should not emit for preexisting dirs when depth is 0 (527ms)
ignored
✓ should check ignore after stating
✓ should not choke on an ignored watch path
✓ should ignore the contents of ignored dirs (361ms)
✓ should allow regex/fn ignores (117ms)
depth
✓ should not recurse if depth is 0
✓ should recurse to specified depth (171ms)
✓ should respect depth setting when following symlinks (65ms)
✓ should respect depth setting when following a new symlink
✓ should correctly handle dir events when depth is 0 (178ms)
atomic
✓ should ignore vim/emacs/Sublime swapfiles (912ms)
✓ should ignore stale tilde files (57ms)
cwd
✓ should emit relative paths based on cwd (62ms)
✓ should emit `addDir` with alwaysStat for renamed directory (1023ms)
✓ should allow separate watchers to have different cwds (102ms)
✓ should ignore files even with cwd (93ms)
ignorePermissionErrors
false
✓ should not watch files without read permissions (509ms)
true
✓ should watch unreadable files if possible (59ms)
✓ should not choke on non-existent files
awaitWriteFinish
✓ should use default options if none given
✓ should not emit add event before a file is fully written (203ms)
✓ should wait for the file to be fully written before emitting the add event (618ms)
✓ should emit with the final stats (926ms)
✓ should not emit change event while a file has not been fully written (309ms)
✓ should not emit change event before an existing file is fully updated (306ms)
✓ should wait for an existing file to be fully updated before emitting the change event (619ms)
✓ should emit change event after the file is fully written (1096ms)
✓ should not raise any event for a file that was deleted before fully written (805ms)
✓ should be compatible with the cwd option (1232ms)
✓ should still emit initial add events
1) should emit an unlink event when a file is updated and deleted just after that
getWatched
✓ should return the watched paths
✓ should set keys relative to cwd & include added paths
unwatch
✓ should stop watching unwatched paths (388ms)
✓ should ignore unwatched paths that are a subset of watched paths (465ms)
✓ should unwatch relative paths (465ms)
✓ should watch paths that were unwatched and added again (168ms)
✓ should unwatch paths that are relative to options.cwd (455ms)
close
✓ should ignore further events on close (904ms)
✓ should not prevent the process from exiting (193ms)
env variable option override
CHOKIDAR_USEPOLLING
✓ should make options.usePolling `true` when CHOKIDAR_USEPOLLING is set to true
✓ should make options.usePolling `true` when CHOKIDAR_USEPOLLING is set to 1
✓ should make options.usePolling `false` when CHOKIDAR_USEPOLLING is set to false
✓ should make options.usePolling `false` when CHOKIDAR_USEPOLLING is set to 0
✓ should not attenuate options.usePolling when CHOKIDAR_USEPOLLING is set to an arbitrary value
CHOKIDAR_INTERVAL
✓ should make options.interval = CHOKIDAR_INTERVAL when it is set
fs.watch (non-polling)
watch a directory
✓ should produce an instance of chokidar.FSWatcher
✓ should expose public API methods
2) should emit `add` event when file was added
3) should emit `addDir` event when directory was added
✓ should emit `change` event when file was changed
✓ should emit `unlink` event when file was removed (118ms)
✓ should emit `unlinkDir` event when a directory was removed (226ms)
✓ should emit `unlink` and `add` events when a file is renamed (307ms)
✓ should emit `add`, not `change`, when previously deleted file is re-added (333ms)
✓ should not emit `unlink` for previously moved files (412ms)
✓ should survive ENOENT for missing subdirectories
✓ should notice when a file appears in a new directory
✓ should watch removed and re-added directories (1539ms)
watch individual files
✓ should detect changes
✓ should detect unlinks (306ms)
4) should detect unlink and re-add
✓ should ignore unwatched siblings (224ms)
renamed directory
✓ should emit `add` for a file in a renamed directory
watch non-existent paths
✓ should watch non-existent file and detect add (219ms)
✓ should watch non-existent dir and detect addDir/add (419ms)
watch glob patterns
✓ should correctly watch and emit based on glob input (222ms)
✓ should respect negated glob patterns (308ms)
✓ should traverse subdirs to match globstar patterns (532ms)
✓ should resolve relative paths with glob patterns (234ms)
✓ should correctly handle conflicting glob patterns (310ms)
✓ should correctly handle intersecting glob patterns (207ms)
✓ should not confuse glob-like filenames with globs (409ms)
✓ should treat glob-like directory names as literal directory names when globbing is disabled
✓ should treat glob-like filenames as literal filenames when globbing is disabled (205ms)
5) should not prematurely filter dirs against complex globstar patterns
✓ should emit matching dir events
watch symlinks
✓ should watch symlinked dirs
watch arrays of paths/globs
6) should watch all paths in an array
✓ should watch symlinked files
✓ should accommodate nested arrays in input
7) should follow symlinked files within a normal dir
8) "before each" hook for "should follow symlinked files within a normal dir"
9) should watch paths with a symlinked parent
128 passing (32s)
9 failing
1) chokidar fsevents (native extension) watch options awaitWriteFinish should emit an unlink event when a file is updated and deleted just after that:
Uncaught Error: ENOENT: no such file or directory, unlink '/Users/creed/Sites/chokidar/test-fixtures/84/subdir/add.txt'
2) chokidar fs.watch (non-polling) watch a directory should emit `add` event when file was added:
Uncaught expected spy to have been called with arguments unlink, add.txt
spy(addDir, ) at emitTwo (events.js:125:13)
AssertionError: expected spy to have been called with arguments unlink, add.txt
at test.js:1660:42
at Timeout.finish (test.js:157:7)
3) chokidar fs.watch (non-polling) watch a directory should emit `addDir` event when directory was added:
Uncaught AssertionError: expected rawSpy to have been called at least once, but it was never called
at test.js:201:34
at finish (test.js:157:7)
at Timeout.<anonymous> (test.js:161:36)
4) chokidar fs.watch (non-polling) watch individual files should detect unlink and re-add:
Uncaught AssertionError: expected spy to have been called exactly once, but it was called 0 times
at test.js:213:31
at Timeout.finish (test.js:157:7)
5) chokidar fs.watch (non-polling) watch glob patterns should not prematurely filter dirs against complex globstar patterns:
Uncaught AssertionError: expected spy to have been called exactly once, but it was called 0 times
at test.js:470:37
at Timeout.finish (test.js:157:7)
6) chokidar fs.watch (non-polling) watch arrays of paths/globs should watch all paths in an array:
Error: EEXIST: file already exists, mkdir '/Users/creed/Sites/chokidar/test-fixtures/132/subdir'
at Object.fs.mkdirSync (fs.js:877:18)
at Context.<anonymous> (test.js:964:10)
at node_modules/graceful-fs/graceful-fs.js:99:16
at node_modules/graceful-fs/graceful-fs.js:43:10
at node_modules/readdirp/node_modules/graceful-fs/graceful-fs.js:43:10
at FSReqWrap.oncomplete (fs.js:135:15)
7) chokidar fs.watch (non-polling) watch symlinks should follow symlinked files within a normal dir:
Error: ENOENT: no such file or directory, symlink '/Users/creed/Sites/chokidar/test-fixtures/135/change.txt' -> '/Users/creed/Sites/chokidar/test-fixtures/135/subdir/link.txt'
at Object.fs.symlinkSync (fs.js:1006:18)
at Context.<anonymous> (test.js:819:10)
8) chokidar fs.watch (non-polling) watch symlinks "before each" hook for "should follow symlinked files within a normal dir":
Error: ENOENT: no such file or directory, open '/Users/creed/Sites/chokidar/test-fixtures/136/subdir/add.txt'
9) chokidar fs.watch (non-polling) watch symlinks should watch paths with a symlinked parent:
Uncaught AssertionError: expected spy to have been called with arguments addDir, /Users/creed/Sites/chokidar/test-fixtures/134-link/subdir
at FSWatcher.<anonymous> (test.js:838:32)
at _combinedTickCallback (internal/process/next_tick.js:95:7)
at process._tickCallback (internal/process/next_tick.js:161:9)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment