Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.map(filepath => {
const source = fs.readFileSync(filepath, 'utf8')
const fileCoverage = allCoverage[filepath]
const sliceInfo = sliceCodeAndGetInfo(source, fileCoverage)
if (sliceInfo.error) {
console.info(
`${filepath} failed to slice:\n${sliceInfo.error.message}\n\n`,
)
console.info(
oneLine(String.raw)`
Here's the filtered coverage:
\n\n${JSON.stringify(sliceInfo.filteredCoverage)}\n\n
`,
)
console.info(`Here's the source:\n\n${source}\n\n`)
// ignore...
}
return {filepath, source, slice: sliceInfo.slice}
})
.filter(({slice}) => !!slice)