Comparing version 1.0.2 to 1.0.3
{ | ||
"name": "sane", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Sane aims to be fast, small, and reliable file system watcher.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -53,5 +53,10 @@ 'use strict'; | ||
} else { | ||
matched = true; | ||
// Make sure we honor the dot option if even we're not using globs. | ||
if (!dot) { | ||
matched = minimatch(relativePath, '**/*', {dot: false}); | ||
} else { | ||
matched = true; | ||
} | ||
} | ||
return matched; | ||
}; |
@@ -206,3 +206,3 @@ 'use strict'; | ||
if (!this.dirRegistery[dir]) { | ||
throw new Error('Unable to find directory in registery: ' + dir); | ||
return; | ||
} | ||
@@ -209,0 +209,0 @@ |
@@ -286,2 +286,45 @@ var os = require('os'); | ||
describe('sane(dir, {dot: false})', function() { | ||
beforeEach(function () { | ||
var Watcher = getWatcherClass(mode); | ||
this.watcher = new Watcher( | ||
testdir, | ||
{ dot: false } | ||
); | ||
}); | ||
afterEach(function(done) { | ||
this.watcher.close(done); | ||
}); | ||
it('should ignore dot files', function (done) { | ||
var i = 0; | ||
this.watcher.on('change', function(filepath, dir) { | ||
assert.ok(filepath.match(/file_(1|2)/), 'only file_1 and file_2'); | ||
assert.equal(dir, testdir); | ||
if (++i == 2) done(); | ||
}); | ||
this.watcher.on('ready', function() { | ||
fs.writeFileSync(jo(testdir, 'file_1'), 'wow'); | ||
fs.writeFileSync(jo(testdir, '.file_9'), 'wow'); | ||
fs.writeFileSync(jo(testdir, '.file_3'), 'wow'); | ||
fs.writeFileSync(jo(testdir, 'file_2'), 'wow'); | ||
}); | ||
}); | ||
it('should ignore dot dirs', function(done) { | ||
this.watcher.on('change', function(filepath, dir) { | ||
assert.ok(filepath.match(/file_1/), 'only file_1 got : ' + filepath); | ||
assert.equal(dir, testdir); | ||
done(); | ||
}); | ||
this.watcher.on('ready', function() { | ||
fs.mkdirSync(jo(testdir, '.lol')); | ||
fs.writeFileSync(jo(testdir, '.lol', 'file'), 'wow'); | ||
fs.writeFileSync(jo(testdir, '.file_3'), 'wow'); | ||
fs.writeFileSync(jo(testdir, 'file_1'), 'wow'); | ||
}); | ||
}); | ||
}); | ||
describe('sane shortcut alias', function () { | ||
@@ -288,0 +331,0 @@ beforeEach(function () { |
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
51875
1012