Skip to content

Commit e15cc82

Browse files
committed
fix: declaration line for coverage needs to be used, not body
1 parent 7b23f13 commit e15cc82

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

task.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -257,11 +257,15 @@ const tasks = {
257257
const writeFile = join(nycReportOptions.reportDir, 'specific', fileName.slice(fileName.lastIndexOf('--') + 2).replace(/\.spec\.[jt]{1}s$/, '') + '.json')
258258

259259
// write every file only once
260-
if (existsSync(writeFile)) continue;
260+
if (existsSync(writeFile)) {
261+
console.log('Skipping', fileName)
262+
continue;
263+
}
261264

262265
console.log('Processing '+fileName)
263266

264267
const fullCoverageMap = await nyc.getCoverageMapFromAllCoverageFiles(join(nycReportOptions.tempDir, 'specific', fileName))
268+
writeFileSync(join(nycReportOptions.reportDir, 'fullCoverageMap.json'), JSON.stringify(fullCoverageMap))
265269

266270
mkdirSync(dirname(writeFile), { recursive: true })
267271
// only write items that actually have values, and only write those values
@@ -293,10 +297,10 @@ const tasks = {
293297
const f = {}
294298
Object.entries(mapData.f).forEach(([index, value]) => {
295299
if (value > 0) {
296-
if (!mapData.fnMap[index].loc || !mapData.fnMap[index].loc.start) {
300+
if (!mapData.fnMap[index].decl || !mapData.fnMap[index].decl.start) {
297301
console.log('not found ', index, ' in ', mapData.fnMap)
298302
}
299-
const lineNr = mapData.fnMap[index].loc.start.line
303+
const lineNr = mapData.fnMap[index].decl.start.line
300304
if (!f[lineNr]) f[lineNr] = []
301305
f[lineNr].push(value)
302306
}

0 commit comments

Comments
 (0)