Incorrect code coverage report when all lines are covered
Description
Code coverage report generated by c8 is showing incorrect result despite all branches are covered.
I even tested it with compiled JavaScript files by swc and the result remains unchanged when there is no additional code generated found at the said line.
Actual behavior

There is 1 additional branch has been reported not being covered.
Expected behavior

All lines are covered and c8 should be able to pick up the result correctly.
Reproduction steps
Reqeuired info
- c8:
7.7.3 - Version:
[email protected] - Platform:
Windows 10 x64
@motss thank you for providing the test case 👍
@motss I dug into your example repo, when I run your test suite, v8 reports a missing block in the getWeekdays method:
{
"functionName": "getWeekdays",
"ranges": [
{
"startOffset": 264,
"endOffset": 1134,
"count": 9
},
{
"startOffset": 413,
"endOffset": 423,
"count": 0
},
{
"startOffset": 499,
"endOffset": 502,
"count": 1
},
{
"startOffset": 503,
"endOffset": 506,
"count": 8
},
{
"startOffset": 547,
"endOffset": 554,
"count": 7
},
{
"startOffset": 605,
"endOffset": 746,
"count": 4
},
{
"startOffset": 666,
"endOffset": 674,
"count": 2
},
{
"startOffset": 675,
"endOffset": 687,
"count": 2
},
{
"startOffset": 747,
"endOffset": 751,
"count": 5
}
],
"isBlockCoverage": true
},
See the:
{
"startOffset": 413,
"endOffset": 423,
"count": 0
},
This missing coverage is happening before c8 does anything.
Is it possible to see the JavaScript generated by @swc/register from the TypeScript code? My guess is that 413 - 423 will be a block of code that is not executed in the transpiled code. The other bug is that I don't believe inline source maps are being created by @swc/register, which leads to the random block of code being highlighted in the file.