Skip to content

Commit ffa62ce

Browse files
bobthekingofegyptnovemberborn
authored andcommitted
Consistent paths in watcher
Fixes #2040 Change the path handling for watcher, now all internal paths should be absolute and chokidar paths will be converted to absolute before handling.
1 parent b27cb8d commit ffa62ce

File tree

2 files changed

+141
-55
lines changed

2 files changed

+141
-55
lines changed

lib/watcher.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ class Watcher {
162162
}).on('all', (event, path) => {
163163
if (event === 'add' || event === 'change' || event === 'unlink') {
164164
debug('Detected %s of %s', event, path);
165-
this.dirtyStates[path] = event;
165+
this.dirtyStates[nodePath.join(this.globs.cwd, path)] = event;
166166
this.debouncer.debounce();
167167
}
168168
});
@@ -180,7 +180,7 @@ class Watcher {
180180
const dependencies = evt.dependencies.map(x => relative(x)).filter(filePath => {
181181
const {isHelper, isSource} = globs.classify(filePath, this.globs);
182182
return isHelper || isSource;
183-
});
183+
}).map(x => nodePath.join(this.globs.cwd, x));
184184
this.updateTestDependencies(evt.testFile, dependencies);
185185
});
186186
});
@@ -215,7 +215,7 @@ class Watcher {
215215
}
216216

217217
for (const file of evt.files) {
218-
this.touchedFiles.add(nodePath.relative(process.cwd(), file));
218+
this.touchedFiles.add(file);
219219
}
220220
});
221221
});

0 commit comments

Comments
 (0)