diff --git a/packages/jest-haste-map/src/crawlers/watchman.ts b/packages/jest-haste-map/src/crawlers/watchman.ts index 83a68dc8872b..20dd7db3965e 100644 --- a/packages/jest-haste-map/src/crawlers/watchman.ts +++ b/packages/jest-haste-map/src/crawlers/watchman.ts @@ -206,9 +206,10 @@ export = async function watchmanCrawl( queryResponse.files.map(async (link: WatchmanFile) => { const name = normalizePathSep(link.name); const linkPath = path.join(watchRoot, name); + const relativePath = fastPath.relative(rootDir, linkPath); if (!link.exists || ignore(linkPath)) { - data.links.delete(linkPath); + data.links.delete(relativePath); return; } @@ -219,10 +220,10 @@ export = async function watchmanCrawl( return; // Skip broken symlinks. } - const metaData = data.links.get(linkPath); + const metaData = data.links.get(relativePath); const mtime = testModified(metaData, link.mtime_ms); dependencyLinks.set( - linkPath, + relativePath, mtime !== 0 ? [target, mtime] : metaData!, );