arboleya / fs-util Goto Github PK
View Code? Open in Web Editor NEWIncremental utilities for NodeJS File System API.
Incremental utilities for NodeJS File System API.
but dev seems to be working,
until you fix this polvo will crash on each file change (with -w option enabled)
running tests in master returns 5 errors
g3z@JBook ~/Documents/Node.js/fs-util $ make test
rm -rf tests/tmp-* tests/a
node_modules/coffee-script/bin/coffee -j lib/fs-util.js -c src/*.coffee
node_modules/mocha/bin/mocha tests/* \
--compilers coffee:coffee-script \
--require should --reporter spec
Current version is: 0.3.10
• FS Tools
When making a deep-dir structure
✓ the structure must to be created
When touching a file
✓ the file must be touched
When copying a structure
✓ the structure must to be copied
When copying a single file
✓ the file must to be copied
When searching a file
✓ the search must to return the proper results
When searching a directory
✓ the search must to return the proper results
When listing a directory
✓ the list must to return the dir contents
When removing a strucuture recursively
✓ the structure must to removed recursively
• FS Watcher
When watching a directory tree
✓ the `watch` event should be emitted properly
When creating a dir inside that tree
✓ the `watch` and `create` event should be emitted properly (163ms)
When deleting this dir
✓ the `unwatch` and `delete` events should be emitted properly (150ms)
When creating a file inside the watched dir
1) the `created` and `watch` events should be emitted properly
When updating this file (a little delay needed here, pay no mind)
2) the `change` event should be emitted properly
When deleting this file
3) the `unwatch` and `delete` events should be emitted properly
When moving an existent structure inside the watched tree
4) the `create` and `watch` events should be emitted properly for all files and dirs
When deleting this structure
5) the `delete` and `unwatch` events should be emitted properly for all files and dirs
✖ 5 of 16 tests failed:
1) • FS Watcher When creating a file inside the watched dir the `created` and `watch` events should be emitted properly:
TypeError: Cannot call method 'test' of undefined
at DirWatcher.diff (/Users/g3z/Documents/Node.js/fs-util/lib/fs-util.js:346:45)
at DirWatcher.onchange (/Users/g3z/Documents/Node.js/fs-util/lib/fs-util.js:312:17)
at FSWatcher.<anonymous> (/Users/g3z/Documents/Node.js/fs-util/lib/fs-util.js:4:61)
at FSWatcher.EventEmitter.emit (events.js:98:17)
at FSEvent.FSWatcher._handle.onchange (fs.js:1039:12)
2) • FS Watcher When updating this file (a little delay needed here, pay no mind) the `change` event should be emitted properly:
TypeError: Cannot call method 'test' of undefined
at DirWatcher.diff (/Users/g3z/Documents/Node.js/fs-util/lib/fs-util.js:346:45)
at DirWatcher.onchange (/Users/g3z/Documents/Node.js/fs-util/lib/fs-util.js:312:17)
at FSWatcher.<anonymous> (/Users/g3z/Documents/Node.js/fs-util/lib/fs-util.js:4:61)
at FSWatcher.EventEmitter.emit (events.js:98:17)
at FSEvent.FSWatcher._handle.onchange (fs.js:1039:12)
3) • FS Watcher When deleting this file the `unwatch` and `delete` events should be emitted properly:
Error: timeout of 2000ms exceeded
at null.<anonymous> (/Users/g3z/Documents/Node.js/fs-util/node_modules/mocha/lib/runnable.js:167:14)
at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)
4) • FS Watcher When moving an existent structure inside the watched tree the `create` and `watch` events should be emitted properly for all files and dirs:
actual expected
/Users/g3z/Documents/Node.js/fs-util/tests/tmp-watcher/filea/b/c/d/e/cinco.coffee
expected '/Users/g3z/Documents/Node.js/fs-util/tests/tmp-watcher/a/b/c/d/e/cinco.coffee' to equal '/Users/g3z/Documents/Node.js/fs-util/tests/tmp-watcher/file.coffee'
at Object.Assertion.equal (/Users/g3z/Documents/Node.js/fs-util/node_modules/should/lib/should.js:303:10)
at Watcher.<anonymous> (/Users/g3z/Documents/Node.js/fs-util/tests/fs-watcher.coffee:105:36)
at Watcher.g (events.js:175:14)
at Watcher.EventEmitter.emit (events.js:117:20)
at FileWatcher.init (/Users/g3z/Documents/Node.js/fs-util/lib/fs-util.js:181:29)
at new FileWatcher (/Users/g3z/Documents/Node.js/fs-util/lib/fs-util.js:170:12)
at DirWatcher.init (/Users/g3z/Documents/Node.js/fs-util/lib/fs-util.js:260:22)
at new DirWatcher (/Users/g3z/Documents/Node.js/fs-util/lib/fs-util.js:235:12)
at DirWatcher.init (/Users/g3z/Documents/Node.js/fs-util/lib/fs-util.js:253:17)
at new DirWatcher (/Users/g3z/Documents/Node.js/fs-util/lib/fs-util.js:235:12)
at DirWatcher.init (/Users/g3z/Documents/Node.js/fs-util/lib/fs-util.js:253:17)
at new DirWatcher (/Users/g3z/Documents/Node.js/fs-util/lib/fs-util.js:235:12)
at DirWatcher.init (/Users/g3z/Documents/Node.js/fs-util/lib/fs-util.js:253:17)
at new DirWatcher (/Users/g3z/Documents/Node.js/fs-util/lib/fs-util.js:235:12)
at DirWatcher.init (/Users/g3z/Documents/Node.js/fs-util/lib/fs-util.js:253:17)
at new DirWatcher (/Users/g3z/Documents/Node.js/fs-util/lib/fs-util.js:235:12)
at DirWatcher.onchange (/Users/g3z/Documents/Node.js/fs-util/lib/fs-util.js:323:46)
at FSWatcher.<anonymous> (/Users/g3z/Documents/Node.js/fs-util/lib/fs-util.js:4:61)
at FSWatcher.EventEmitter.emit (events.js:98:17)
at FSEvent.FSWatcher._handle.onchange (fs.js:1039:12)
5) • FS Watcher When deleting this structure the `delete` and `unwatch` events should be emitted properly for all files and dirs:
Error: timeout of 2000ms exceeded
at null.<anonymous> (/Users/g3z/Documents/Node.js/fs-util/node_modules/mocha/lib/runnable.js:167:14)
at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)
make: *** [test] Error 5
Using it for some time watching an assets folder, then after adding / deleting loads of files i got this error and the process exited.
could this code be wrapped into a try / catch and then outputted to stdout instead of becoming a fatal ?
/var/projects/watcher/node_modules/fs-util/lib/fs-util.js:210
if (this.curr.mtime > this.prev.mtime) {
^
TypeError: Cannot read property 'mtime' of null
at FileWatcher.onchange (/var/projects/watcher/node_modules/fs-util/lib/fs-util.js:210:38)
at StatWatcher. (/var/projects/watcher/node_modules/fs-util/lib/fs-util.js:4:61)
at StatWatcher.EventEmitter.emit (events.js:98:17)
at StatWatcher._handle.onchange (fs.js:1109:10)
make: *** [watch.ark] Error 8
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.