This is a minimal reproduction case for https://bugs.chromium.org/p/chromium/issues/detail?id=1127392 Steps:
- Install extension
- Open extension's background script debug panel (we gonna use that to inspect coverage report)
- Open index.html page
- Launch extension and click "Start coverage collection"
- On index.html press "Trigger sample function" button
- In extension popup click "Stop coverage collection" (make sure devtools panel for extension's background script is open!)
- Devtools should pause on "debugger;" statement. See contents of
data
variable to see collected coverage It must contain 2 elements, first one nestingsample
function coverage, with the following properties:
functions: Array(1)
0:
functionName: "sample"
isBlockCoverage: true
ranges: Array(3)
0: {count: 1, endOffset: 390, startOffset: 28}
1: {count: 0, endOffset: 237, startOffset: 183}
2: {count: 0, endOffset: 357, startOffset: 245}
length: 3
Range [0] "covers" the whole function with execution count of one While ranges [1] and [2] "exclude" not-covered lines from that range At that point, everything is correct
- Without reloading the page perform steps from 4 to 7 and check
data
variable again
It must contain coverage with multiple ranges that describes execution of second case from switch statement.
But instead, it holds single range for the whole function and nothing else:
functions: Array(1)
0:
functionName: "sample"
isBlockCoverage: false
ranges: Array(1)
0: {count: 1, endOffset: 390, startOffset: 28}
length: 1
IMPORTANT NOTE: It appears if you perform step 8 after:
- you open other tab
- AND wait long enough (like around 5-10 minutes) coverage is going to be correct (containing multiple ranges, covering switch case 2 with correct execution counts)
P.S. All steps described above are performed without any target page ( index.html ) reloads whatsoever