Skip to content

Commit

Permalink
Merge pull request #211 from webpack/bugfix/missing-info
Browse files Browse the repository at this point in the history
fix missing time info in files
  • Loading branch information
sokra authored Nov 24, 2021
2 parents 89d5f48 + 1e56026 commit c82a595
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/DirectoryWatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -735,8 +735,8 @@ class DirectoryWatcher extends EventEmitter {
for (const watchers of this.watchers.values()) {
for (const watcher of watchers) {
const path = watcher.path;
if (!directoryTimestamps.has(path)) {
directoryTimestamps.set(path, null);
if (!fileTimestamps.has(path)) {
fileTimestamps.set(path, null);
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion test/Watchpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,7 @@ describe("Watchpack", function() {
const sub = directories.get(path.join(fixtures, "dir", "sub"));
const subAsFile = files.get(path.join(fixtures, "dir", "sub"));
const a = files.get(path.join(fixtures, "dir", "sub", "a"));
const file = files.get(path.join(fixtures, "file"));
dir.should.be.type("object");
dir.should.have.property("safeTime");
dirAsFile.should.be.type("object");
Expand All @@ -581,6 +582,7 @@ describe("Watchpack", function() {
a.should.be.type("object");
a.should.have.property("safeTime");
a.should.have.property("timestamp");
(file === null).should.be.eql(true);
sub.safeTime.should.be.aboveOrEqual(a.safeTime);
dir.safeTime.should.be.aboveOrEqual(sub.safeTime);
w.close();
Expand All @@ -590,7 +592,7 @@ describe("Watchpack", function() {
testHelper.dir(path.join("dir", "sub"));
testHelper.dir(path.join("dir", "sub2"));
testHelper.tick(function() {
w.watch([], [path.join(fixtures, "dir")]);
w.watch([path.join(fixtures, "file")], [path.join(fixtures, "dir")]);
testHelper.tick(function() {
testHelper.file(path.join("dir", "sub", "a"));
});
Expand Down

0 comments on commit c82a595

Please sign in to comment.