ryanluker / vscode-coverage-gutters

Display test coverage generated by lcov and xml - works with many languages
https://marketplace.visualstudio.com/items?itemName=ryanluker.vscode-coverage-gutters
MIT License
464 stars 90 forks source link

`Illegal argument: line must be non-negative` when any `detail.line` is 0 #424

Closed sfc-gh-wzhao closed 1 year ago

sfc-gh-wzhao commented 1 year ago

Describe the bug When parsing a coverage dat file where leads to section.lines.details or section.branches.details's element in renderer will lead to Illegal argument: line must be non-negative.

To Reproduce Steps to reproduce the behaviour:

  1. Create a coverage lcov file containing information at line 0.
  2. Enable coverage display

Expected behaviour They should be ignored and not affect display coverage info.

Screenshots Traceback:

Error: Illegal argument: line must be non-negative
    at $ (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:10:1101)
    at new n (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:103:4331)
    at new o (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:103:5847)
    at /Users/****/.vscode/extensions/ryanluker.vscode-coverage-gutters-2.11.0/out/src/coverage-system/renderer.js:92:34
    at Array.forEach (<anonymous>)
    at Renderer.filterBranchCoverage (/Users/****/.vscode/extensions/ryanluker.vscode-coverage-gutters-2.11.0/out/src/coverage-system/renderer.js:91:14)
    at /Users/****/.vscode/extensions/ryanluker.vscode-coverage-gutters-2.11.0/out/src/coverage-system/renderer.js:59:18
    at Array.forEach (<anonymous>)
    at Renderer.filterCoverage (/Users/****/.vscode/extensions/ryanluker.vscode-coverage-gutters-2.11.0/out/src/coverage-system/renderer.js:57:18)
    at /Users/****/.vscode/extensions/ryanluker.vscode-coverage-gutters-2.11.0/out/src/coverage-system/renderer.js:36:18
    at Array.forEach (<anonymous>)
    at Renderer.renderCoverage (/Users/****/.vscode/extensions/ryanluker.vscode-coverage-gutters-2.11.0/out/src/coverage-system/renderer.js:25:21)
    at CoverageService.<anonymous> (/Users/****/.vscode/extensions/ryanluker.vscode-coverage-gutters-2.11.0/out/src/coverage-system/coverageservice.js:99:31)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/****/.vscode/extensions/ryanluker.vscode-coverage-gutters-2.11.0/node_modules/tslib/tslib.js:115:62)

Desktop (please complete the following information):

Additional context I think it should be a easy fix by changing the filter in Line 67 and 90 from >= to >.

ryanluker commented 1 year ago

@sfc-gh-wzhao Thanks for the ticket and PR! Taking a look today at open PRs / new tickets so I will adds yours to the queue.