diff --git a/packages/vitest/src/utils/source-map.ts b/packages/vitest/src/utils/source-map.ts index 7bfdadb24..aa776cbee 100644 --- a/packages/vitest/src/utils/source-map.ts +++ b/packages/vitest/src/utils/source-map.ts @@ -2,7 +2,7 @@ import { SourceMapConsumer } from 'source-map-js' import type { RawSourceMap } from 'vite-node' import type { ErrorWithDiff, ParsedStack, Position } from '../types' import type { Vitest } from '../node' -import { notNullish } from './base' +import { notNullish, slash } from './base' export const lineSplitRE = /\r?\n/ @@ -58,7 +58,7 @@ export function parseStacktrace(e: ErrorWithDiff, full = false): ParsedStack[] { if (!match) return null - let file = match[2] + let file = slash(match[2]) if (file.startsWith('file://')) file = file.slice(7)