From 58384db8a4948e671b6271c6da1b62224a037062 Mon Sep 17 00:00:00 2001 From: Alec Larson Date: Fri, 8 Mar 2019 17:01:06 -0500 Subject: [PATCH] fix: use relative path as key in "links" map --- packages/jest-haste-map/src/crawlers/watchman.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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!, );