MCPcopy
hub / github.com/vitest-dev/vitest / getSourceMap

Method getSourceMap

packages/vitest/src/node/test-run.ts:174–185  ·  view source on GitHub ↗
(file)

Source from the content-addressed store, hash-verified

172 error.stacks = parseErrorStacktrace(error, {
173 frameFilter: project.config.onStackTrace,
174 getSourceMap(file) {
175 // This only handles external modules since
176 // source map is already applied for inlined modules.
177 // Module node exists due to Vitest fetch module,
178 // but transformResult should be empty for external modules.
179 const mod = project.vite.moduleGraph.getModuleById(file)
180 if (!mod?.transformResult && existsSync(file)) {
181 const code = readFileSync(file, 'utf-8')
182 const result = extractSourcemapFromFile(code, file)
183 return result?.map
184 }
185 },
186 })
187 }
188 })

Callers 1

parseStacktraceFunction · 0.80

Calls 2

extractSourcemapFromFileFunction · 0.90
readFileSyncFunction · 0.85

Tested by

no test coverage detected