Skip to content

Commit 7b79901

Browse files
committed
fix(task.js): return sourceRoot+source if source doesn't include fileName in fixSourcePaths
1 parent b3adfa7 commit 7b79901

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

cypress/e2e/fix-source-paths.cy.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe('fixSourcePaths', () => {
2424
'/absolute/src/component.vue': {
2525
path: '/absolute/src/component.vue',
2626
inputSourceMap: {
27-
sources: ['/absolute/src/component.vue', 'otherFile.js'],
27+
sources: ['/absolute/src/component.vue', 'src/otherFile.js'],
2828
sourceRoot: ''
2929
}
3030
},

support-utils.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,12 @@ function fixSourcePaths(coverage) {
141141
const fileName = /([^\/\\]+)$/.exec(absolutePath)[1]
142142
if (!fileName) return
143143

144-
if (inputSourceMap.sourceRoot) inputSourceMap.sourceRoot = ''
145144
inputSourceMap.sources = inputSourceMap.sources.map((source) =>
146-
source.includes(fileName) ? absolutePath : source
145+
source.includes(fileName)
146+
? absolutePath
147+
: `${inputSourceMap.sourceRoot}/${source}`
147148
)
149+
if (inputSourceMap.sourceRoot) inputSourceMap.sourceRoot = ''
148150
})
149151
}
150152

0 commit comments

Comments
 (0)