glob-watcher
Advanced tools
Comparing version 0.0.1 to 0.0.2
13
index.js
var gaze = require('gaze'); | ||
var EventEmitter = require('events').EventEmitter; | ||
module.exports = function(glob, cb) { | ||
module.exports = function(glob, opts, cb) { | ||
var out = new EventEmitter(); | ||
var watcher = gaze(glob, function(err, rwatcher){ | ||
if (typeof opts === 'function') { | ||
cb = opts; | ||
opts = {}; | ||
} | ||
var watcher = gaze(glob, opts, function(err, rwatcher){ | ||
rwatcher.on('all', function(evt, path, old){ | ||
@@ -27,3 +32,3 @@ var outEvt = {type: evt, path: path}; | ||
out.add = function(){ | ||
return watcher.add.call(watcher, arguments); | ||
return watcher.add.apply(watcher, arguments); | ||
}; | ||
@@ -36,2 +41,2 @@ out.remove = function(){ | ||
return out; | ||
}; | ||
}; |
{ | ||
"name": "glob-watcher", | ||
"description": "Watch globs", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"homepage": "http://github.com/wearefractal/glob-watcher", | ||
@@ -6,0 +6,0 @@ "repository": "git://github.com/wearefractal/glob-watcher.git", |
@@ -33,3 +33,3 @@ var watch = require('../'); | ||
it('should return a valid file struct via vallback', function(done) { | ||
it('should return a valid file struct via callback', function(done) { | ||
var expectedName = join(__dirname, "./fixtures/stuff/test.coffee"); | ||
@@ -56,2 +56,21 @@ var fname = join(__dirname, "./fixtures/**/test.coffee"); | ||
}); | ||
it('should not return a non-matching file struct via callback', function(done) { | ||
var expectedName = join(__dirname, "./fixtures/test123.coffee"); | ||
var fname = join(__dirname, "./fixtures/**/test.coffee"); | ||
fs.writeFileSync(expectedName, "testing"); | ||
var watcher = watch(fname, function(evt) { | ||
throw new Error("Should not have been called! "+evt.path); | ||
}); | ||
setTimeout(function(){ | ||
fs.writeFileSync(expectedName, "test test"); | ||
}, 200); | ||
setTimeout(function(){ | ||
rimraf.sync(expectedName); | ||
done(); | ||
}, 1500); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6938
8
97