-
-
Notifications
You must be signed in to change notification settings - Fork 39
Description
Hello,
So I am trying to convert my v8 coverage to istanbul and got surprised that the translation is not working as expected.
Unfortunately I cannot share a repo for you to debug, so I have to debug this myself.
After loading the source,
v8-to-istanbul/lib/v8-to-istanbul.js
Line 47 in 4488d10
| async load () { |
[
{
source: CovSource {
lines: [Array],
eof: 736,
shebangLength: 0,
wrapperLength: 0
},
path: 'webpack://A.ts'
},
{
source: CovSource {
lines: [Array],
eof: 1087,
shebangLength: 0,
wrapperLength: 0
},
path: 'webpack://B.ts'
},
{
source: CovSource {
lines: [Array],
eof: 2275,
shebangLength: 0,
wrapperLength: 0
},
path: 'webpack://C.ts'
},
{
source: CovSource {
lines: [Array],
eof: 15840,
shebangLength: 0,
wrapperLength: 0
},
path: 'webpack://D.ts'
},
{
source: CovSource {
lines: [Array],
eof: 1884,
shebangLength: 0,
wrapperLength: 0
},
path: 'webpack://E.ts'
},
{
source: CovSource {
lines: [Array],
eof: 11237,
shebangLength: 0,
wrapperLength: 0
},
path: 'webpack://F.ts'
},
{
source: CovSource {
lines: [Array],
eof: 11691,
shebangLength: 0,
wrapperLength: 0
},
path: 'webpack://G.ts'
}
]are loaded as this.covSources
v8-to-istanbul/lib/v8-to-istanbul.js
Line 38 in 4488d10
| this.covSources = [] |
v8-to-istanbul/lib/v8-to-istanbul.js
Line 128 in 4488d10
| applyCoverage (blocks) { |
When
applyCoverage is called, const { startCol, endCol, path, covSource } = this._maybeRemapStartColEndCol(range, isEmptyCoverage) should give me one of the covSource above.v8-to-istanbul/lib/v8-to-istanbul.js
Line 132 in 4488d10
| const { startCol, endCol, path, covSource } = this._maybeRemapStartColEndCol(range, isEmptyCoverage) |
Based on the current implementation,
{
source: CovSource {
lines: [Array],
eof: 736,
shebangLength: 0,
wrapperLength: 0
},
path: 'webpack://A.ts'
},v8-to-istanbul/lib/v8-to-istanbul.js
Line 212 in 4488d10
| let covSource = this.covSources[0].source |
block value because it will always use the first object in the list. In my case, the functionName is from webpack://G.tsEdit: See comment below
Line 20 in 4488d10
| "functionName": "", |
As a result, all the data are messed up...