Comparing version
@@ -5,7 +5,4 @@ 'use strict'; | ||
var path = require('path'); | ||
var promisify = require('promisify-node'); | ||
var fse = promisify(require('fs-extra')); | ||
var exec = promisify(function (command, options, callback) { | ||
return require('child_process').exec(command, options, callback); | ||
}); | ||
var fse = require('fs-extra'); | ||
var exec = require('executive'); | ||
@@ -41,3 +38,3 @@ jasmine.DEFAULT_TIMEOUT_INTERVAL = 120000; | ||
var promises = []; | ||
for (var i = 0; i < 5; ++i) { | ||
for (var i = 0; i < 10; ++i) { | ||
promises.push(makeDir(i)); | ||
@@ -325,2 +322,41 @@ } | ||
}); | ||
if (process.platform) { | ||
it('will properly track the movement of watched directories across watched directories', function (done) { | ||
var watch = void 0; | ||
var performRenameProcedure = function performRenameProcedure(number) { | ||
return fse.mkdir(path.join(workDir, 'test' + number, 'sneaky-folder')).then(function () { | ||
return fse.move(path.join(workDir, 'test' + number, 'folder' + number), path.join(workDir, 'test' + (number + 1), 'bad-folder')); | ||
}).then(function () { | ||
return fse.move(path.join(workDir, 'test' + number, 'sneaky-folder'), path.join(workDir, 'test' + number, 'bad-folder')); | ||
}).then(function () { | ||
return fse.remove(path.join(workDir, 'test' + number)); | ||
}).then(function () { | ||
return fse.remove(path.join(workDir, 'test' + (number + 1))); | ||
}); | ||
}; | ||
return nsfw(workDir, function () {}, { debounceMS: DEBOUNCE }).then(function (_w) { | ||
watch = _w; | ||
return watch.start(); | ||
}).then(function () { | ||
return new Promise(function (resolve) { | ||
setTimeout(resolve, TIMEOUT_PER_STEP); | ||
}); | ||
}).then(function () { | ||
return Promise.all([performRenameProcedure(0), performRenameProcedure(2), performRenameProcedure(4), performRenameProcedure(6), performRenameProcedure(8)]); | ||
}).then(function () { | ||
return new Promise(function (resolve) { | ||
setTimeout(resolve, TIMEOUT_PER_STEP); | ||
}); | ||
}).then(function () { | ||
return watch.stop(); | ||
}).then(done, function () { | ||
return watch.stop().then(function (err) { | ||
return done.fail(err); | ||
}); | ||
}); | ||
}); | ||
} | ||
}); | ||
@@ -327,0 +363,0 @@ |
{ | ||
"name": "nsfw", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "A simple file watcher for Node", | ||
@@ -5,0 +5,0 @@ "main": "lib/src/index.js", |
@@ -102,2 +102,3 @@ # node-sentinel-file-watcher | ||
"oldFile": "oldname.ext", | ||
"newDirectory": "home/nsfw/watchDir/otherDirectory" | ||
"newFile": "newname.ext" | ||
@@ -104,0 +105,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
93426
4%699
4.95%121
0.83%1
-50%