Skip to content

Commit 7b23f13

Browse files
committed
feat: send multiple items of per-test coverage data
1 parent fd324c9 commit 7b23f13

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "@cypress/code-coverage",
3-
"version": "0.0.0-development",
2+
"name": "@aeolun/code-coverage",
3+
"version": "3.11.0",
44
"description": "Saves the code coverage collected during Cypress tests",
55
"main": "index.js",
66
"scripts": {

task.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,15 +267,16 @@ const tasks = {
267267
// only write items that actually have values, and only write those values
268268
writeFileSync(writeFile, JSON.stringify(Object.values(fullCoverageMap.data).map(data => {
269269
const mapData = data.data
270-
//console.log('mapdata', mapData)
270+
271271
const b = {}
272272
Object.entries(mapData.b).forEach(([index, value]) => {
273273
if (value.some(i => i > 0)) {
274274
if (!mapData.branchMap[index].loc || !mapData.branchMap[index].loc.start) {
275275
console.log('not found ', index, ' in ', mapData.branchMap)
276276
}
277277
const lineNr = mapData.branchMap[index].loc.start.line
278-
b[lineNr] = value
278+
if (!b[lineNr]) b[lineNr] = []
279+
b[lineNr].push(value)
279280
}
280281
})
281282
const s = {}
@@ -285,7 +286,8 @@ const tasks = {
285286
console.log('not found ', index, ' in ', mapData.statementMap)
286287
}
287288
const lineNr = mapData.statementMap[index].start.line
288-
s[lineNr] = value
289+
if (!s[lineNr]) s[lineNr] = []
290+
s[lineNr].push(value)
289291
}
290292
})
291293
const f = {}
@@ -295,7 +297,8 @@ const tasks = {
295297
console.log('not found ', index, ' in ', mapData.fnMap)
296298
}
297299
const lineNr = mapData.fnMap[index].loc.start.line
298-
f[lineNr] = value
300+
if (!f[lineNr]) f[lineNr] = []
301+
f[lineNr].push(value)
299302
}
300303
})
301304

0 commit comments

Comments
 (0)