diff --git a/packages/vitest/src/api/setup.ts b/packages/vitest/src/api/setup.ts index ac1a63f45f75..9abd0b32b1af 100644 --- a/packages/vitest/src/api/setup.ts +++ b/packages/vitest/src/api/setup.ts @@ -113,21 +113,11 @@ export function setup(vitestOrWorkspace: Vitest | WorkspaceProject, _server?: Vi getConfig() { return vitestOrWorkspace.config }, - async getBrowserFileSourceMap(id, options) { + async getBrowserFileSourceMap(id) { if (!('ctx' in vitestOrWorkspace)) return undefined const mod = vitestOrWorkspace.browser?.moduleGraph.getModuleById(id) - if (!mod) - return undefined - - const ssr = !!options?.ssr - // should technically only be a single module because we don't load test files with multiple modules - if (ssr && mod.ssrTransformResult) - return mod.ssrTransformResult.map - if (mod.transformResult) - return mod.transformResult.map - - return undefined + return mod?.transformResult?.map }, async getTransformResult(id) { const result: TransformResultWithSource | null | undefined = await ctx.vitenode.transformRequest(id) diff --git a/packages/vitest/src/api/types.ts b/packages/vitest/src/api/types.ts index 2d1d743be3ee..4b47bedc7ed2 100644 --- a/packages/vitest/src/api/types.ts +++ b/packages/vitest/src/api/types.ts @@ -20,7 +20,7 @@ export interface WebSocketHandlers { resolveSnapshotPath: (testPath: string) => string resolveSnapshotRawPath: (testPath: string, rawPath: string) => string getModuleGraph: (id: string) => Promise - getBrowserFileSourceMap: (id: string, options?: { ssr: boolean }) => Promise + getBrowserFileSourceMap: (id: string) => Promise getTransformResult: (id: string) => Promise readSnapshotFile: (id: string) => Promise readTestFile: (id: string) => Promise