Skip to content

Commit

Permalink
chore: remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed Mar 14, 2024
1 parent 16f21fe commit 28d9949
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
14 changes: 2 additions & 12 deletions packages/vitest/src/api/setup.ts
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion packages/vitest/src/api/types.ts
Expand Up @@ -20,7 +20,7 @@ export interface WebSocketHandlers {
resolveSnapshotPath: (testPath: string) => string
resolveSnapshotRawPath: (testPath: string, rawPath: string) => string
getModuleGraph: (id: string) => Promise<ModuleGraphData>
getBrowserFileSourceMap: (id: string, options?: { ssr: boolean }) => Promise<TransformResult['map'] | undefined>
getBrowserFileSourceMap: (id: string) => Promise<TransformResult['map'] | undefined>
getTransformResult: (id: string) => Promise<TransformResultWithSource | undefined>
readSnapshotFile: (id: string) => Promise<string | null>
readTestFile: (id: string) => Promise<string | null>
Expand Down

0 comments on commit 28d9949

Please sign in to comment.