From aee886ef269c47773267b9180f0382c30cbbfd30 Mon Sep 17 00:00:00 2001 From: Ivan Demchuk Date: Tue, 8 Feb 2022 03:07:57 +0200 Subject: [PATCH] fix: use correct file paths in coverage reports (fix #691) (#692) --- packages/vitest/src/integrations/coverage.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/vitest/src/integrations/coverage.ts b/packages/vitest/src/integrations/coverage.ts index 50c203c86a0e..162b7df62174 100644 --- a/packages/vitest/src/integrations/coverage.ts +++ b/packages/vitest/src/integrations/coverage.ts @@ -84,9 +84,9 @@ export async function reportCoverage(ctx: Vitest) { } catch {} - const sources = map.sources.length - ? map.sources.map(i => pathToFileURL(i).href) - : [url] + // Vite does not report full path in sourcemap sources + // so use an actual file path + const sources = [url] sourceMapMata[url] = { source: result.code,