Comparing version
{ | ||
"name": "watchpack", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "", | ||
@@ -29,5 +29,5 @@ "main": "./lib/watchpack.js", | ||
"async": "^0.9.0", | ||
"chokidar": "^0.8.2", | ||
"chokidar": "^0.10.3", | ||
"graceful-fs": "^3.0.2" | ||
} | ||
} |
@@ -40,2 +40,7 @@ var fs = require("fs"); | ||
TestHelper.prototype.mtime = function mtime(name, mtime) { | ||
var stats = fs.statSync(path.join(this.testdir, name)); | ||
fs.utimesSync(path.join(this.testdir, name), stats.atime, new Date(mtime)); | ||
}; | ||
TestHelper.prototype.remove = function remove(name) { | ||
@@ -42,0 +47,0 @@ rimraf.sync(path.join(this.testdir, name)); |
@@ -13,3 +13,3 @@ var should = require("should"); | ||
afterEach(testHelper.after); | ||
it("should watch a single file", function(done) { | ||
@@ -35,3 +35,3 @@ var w = new Watchpack({ | ||
}); | ||
it("should watch multiple files", function(done) { | ||
@@ -76,3 +76,3 @@ var w = new Watchpack({ | ||
}); | ||
it("should watch a directory", function(done) { | ||
@@ -102,3 +102,3 @@ var w = new Watchpack({ | ||
}); | ||
it("should watch file in a sub directory", function(done) { | ||
@@ -129,2 +129,34 @@ var w = new Watchpack({ | ||
}); | ||
it("should detect a single change to future timestamps", function(done) { | ||
var w = new Watchpack({ | ||
aggregateTimeout: 1000 | ||
}); | ||
var w2 = new Watchpack({ | ||
aggregateTimeout: 1000 | ||
}); | ||
w.on("change", function(file, mtime) { | ||
throw new Error("should not report change event"); | ||
}); | ||
w.on("aggregated", function(changes) { | ||
throw new Error("should not report aggregated event"); | ||
}); | ||
testHelper.file("a"); | ||
testHelper.tick(function() { | ||
w2.watch([path.join(fixtures, "a")], []); | ||
testHelper.tick(function() { | ||
testHelper.mtime("a", Date.now() + 1000000); | ||
testHelper.tick(function() { | ||
w.watch([path.join(fixtures, "a")], []); | ||
testHelper.tick(function() { | ||
testHelper.tick(function() { | ||
w2.close(); | ||
w.close(); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
23708
4.66%743
4.94%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
Updated