Skip to content

Commit c82a595

Browse files
authored
Merge pull request #211 from webpack/bugfix/missing-info
fix missing time info in files
2 parents 89d5f48 + 1e56026 commit c82a595

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

lib/DirectoryWatcher.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -735,8 +735,8 @@ class DirectoryWatcher extends EventEmitter {
735735
for (const watchers of this.watchers.values()) {
736736
for (const watcher of watchers) {
737737
const path = watcher.path;
738-
if (!directoryTimestamps.has(path)) {
739-
directoryTimestamps.set(path, null);
738+
if (!fileTimestamps.has(path)) {
739+
fileTimestamps.set(path, null);
740740
}
741741
}
742742
}

test/Watchpack.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,7 @@ describe("Watchpack", function() {
570570
const sub = directories.get(path.join(fixtures, "dir", "sub"));
571571
const subAsFile = files.get(path.join(fixtures, "dir", "sub"));
572572
const a = files.get(path.join(fixtures, "dir", "sub", "a"));
573+
const file = files.get(path.join(fixtures, "file"));
573574
dir.should.be.type("object");
574575
dir.should.have.property("safeTime");
575576
dirAsFile.should.be.type("object");
@@ -581,6 +582,7 @@ describe("Watchpack", function() {
581582
a.should.be.type("object");
582583
a.should.have.property("safeTime");
583584
a.should.have.property("timestamp");
585+
(file === null).should.be.eql(true);
584586
sub.safeTime.should.be.aboveOrEqual(a.safeTime);
585587
dir.safeTime.should.be.aboveOrEqual(sub.safeTime);
586588
w.close();
@@ -590,7 +592,7 @@ describe("Watchpack", function() {
590592
testHelper.dir(path.join("dir", "sub"));
591593
testHelper.dir(path.join("dir", "sub2"));
592594
testHelper.tick(function() {
593-
w.watch([], [path.join(fixtures, "dir")]);
595+
w.watch([path.join(fixtures, "file")], [path.join(fixtures, "dir")]);
594596
testHelper.tick(function() {
595597
testHelper.file(path.join("dir", "sub", "a"));
596598
});

0 commit comments

Comments
 (0)