Comparing version
@@ -8,3 +8,6 @@ 'use strict'; | ||
function sane(dir, options) { | ||
if (options.poll) { | ||
if (options.watcher) { | ||
var WatcherClass = require(options.watcher); | ||
return new WatcherClass(dir, options); | ||
} else if (options.poll) { | ||
return new PollWatcher(dir, options); | ||
@@ -11,0 +14,0 @@ } else if (options.watchman) { |
{ | ||
"name": "sane", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "Sane aims to be fast, small, and reliable file system watcher.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -75,2 +75,23 @@ var os = require('os'); | ||
describe('sane plugin', function () { | ||
beforeEach(function () { | ||
this.watcher = sane(testdir, { | ||
glob: '**/file_1', | ||
watcher: './test/plugin_watcher', | ||
}); | ||
}); | ||
afterEach(function (done) { | ||
this.watcher.close(done); | ||
}); | ||
it('uses the custom plugin watcher', function (done) { | ||
this.watcher.on('is-test-plugin', function () { | ||
done(); | ||
}); | ||
}); | ||
}); | ||
describe('sane(file)', function() { | ||
@@ -77,0 +98,0 @@ beforeEach(function () { |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
61210
5.97%15
7.14%1245
10.86%6
50%