Created
December 2, 2020 15:09
-
-
Save philpalmieri/0591a3130ad168428deff4d314b97d5f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/////////////////////////////// | |
package.json | |
//////////////////////////////// | |
"scripts": { | |
"fixlcov": "node fixlcov.js" | |
}, | |
///////////////////////////////// | |
fixlcov.js | |
/////////////////////////////// | |
'use strict'; | |
const path = require('path'); | |
const { readFileSync, writeFileSync } = require('fs'); | |
(() => { | |
const lcovFile = path.resolve(__dirname, './coverage/lcov.info') | |
const rawFile = readFileSync(lcovFile, 'utf8') | |
const rebuiltPaths = rawFile.split('\n').map(singleLine => { | |
if (singleLine.startsWith('SF:')) { | |
return singleLine.replace('SF:', `SF:${__dirname}/`) | |
} | |
return singleLine | |
}).join('\n') | |
console.log(rebuiltPaths) | |
writeFileSync(lcovFile, rebuiltPaths, 'utf8') | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment