Skip to content

Commit

Permalink
support inline source map
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverzy authored Feb 2, 2023
1 parent 4fc492c commit 32767ec
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/coverage-c8/src/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,13 @@ export class C8CoverageProvider implements CoverageProvider {
// that we add in packages/vite-node/src/client.ts:114 (vm.runInThisContext)
// TODO: Include our transformations in sourcemaps
const offset = 185

const originalGetSourceMap = report._getSourceMap;
report._getSourceMap = (coverage: Profiler.ScriptCoverage) => {
const path = _url.pathToFileURL(coverage.url.split('?')[0]).href
const data = sourceMapMeta[path]

if (!data)
return {}
return originalGetSourceMap.call(report, coverage)

return {
sourceMap: {
Expand Down
1 change: 1 addition & 0 deletions packages/vite-node/src/source-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export function installSourcemapsSupport(options: InstallSourceMapSupportOptions
install({
environment: 'node',
handleUncaughtExceptions: false,
hookRequire: true,
retrieveSourceMap(source) {
const map = options.getSourceMap(source)
if (map) {
Expand Down

0 comments on commit 32767ec

Please sign in to comment.