Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: cypress-io/code-coverage
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: maiieul/code-coverage
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 1 commit
  • 2 files changed
  • 1 contributor

Commits on Dec 18, 2024

  1. fix source path

    maiieul committed Dec 18, 2024
    Copy the full SHA
    5bb7413 View commit details
Showing with 10 additions and 5 deletions.
  1. +1 −1 cypress/e2e/fix-source-paths.cy.js
  2. +9 −4 support-utils.js
2 changes: 1 addition & 1 deletion cypress/e2e/fix-source-paths.cy.js
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ describe('fixSourcePaths', () => {
'/absolute/src/component.vue': {
path: '/absolute/src/component.vue',
inputSourceMap: {
sources: ['/absolute/src/component.vue', 'otherFile.js'],
sources: ['/absolute/src/component.vue', 'src/otherFile.js'],
sourceRoot: ''
}
},
13 changes: 9 additions & 4 deletions support-utils.js
Original file line number Diff line number Diff line change
@@ -140,11 +140,16 @@ function fixSourcePaths(coverage) {
if (!inputSourceMap) return
const fileName = /([^\/\\]+)$/.exec(absolutePath)[1]
if (!fileName) return
// debug("fileName: ", fileName)

if (inputSourceMap.sourceRoot) inputSourceMap.sourceRoot = ''
inputSourceMap.sources = inputSourceMap.sources.map((source) =>
source.includes(fileName) ? absolutePath : source
)
inputSourceMap.sources = inputSourceMap.sources.map((source) => {

// debug("source: ", source, "fileName: ", fileName, "absolutePath: ", absolutePath)
return source.includes(fileName) ? absolutePath : `${inputSourceMap.sourceRoot}/${source}`
}
)
if (inputSourceMap.sourceRoot) inputSourceMap.sourceRoot = ''
// debug("inputSourceMap.sources: ", inputSourceMap.sources)
})
}