MCPcopy Index your code
hub / github.com/alexdima/vscode-lcov

github.com/alexdima/vscode-lcov @v0.3.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.3.0 ↗ · + Follow
146 symbols 249 edges 18 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

VSCode LCOV

Renders Line and Branch coverage from lcov.info files interactively.

Live coverage info

Live info

Features

  • loosely coupled, just point it to a lcov.info file and you're in business!
  • can read multiple lcov.info files (e.g. one for the entire project, one for the last single test run)
  • generates a Coverage Report
  • supports watching certain files and executing a command (e.g. run test on file change)
  • supports JavaScript source maps

Coverage Report

  • Ctrl+T or Cmd+T then choose Show Coverage Report Coverage Report

Setting up

  • There is a complete simple example at https://github.com/alexandrudima/vscode-lcov/tree/master/examples/fizzbuzz
  • There are many tools that can generate lcov.info files
  • I have tested lcov.info files generated by istanbul e.g.istanbul cover --report lcovonly ./node_modules/mocha/bin/_mocha -- -R spec test.js
  • Configure the paths to your lcov.info files via the setting lcov.path. e.g:
"lcov.path": [
    "./.build/coverage/lcov.info",
    "./.build/coverage-single/lcov.info"
]
  • Live coverage via the setting lcov.watch. e.g. to execute a certain command any time a .js file is changed:
"lcov.watch": [{
    "pattern": "**/*.js",
    "command": "npm run test-coverage"
}]
  • Live coverage can be switched on via Ctrl+T or Cmd+T then choose Enable watchers
  • JavaScript sourcemaps via the setting lcov.sourceMaps.
"lcov.sourceMaps": true

Troubleshooting

  • View > Output and choose lcov.

Branch coverage: Configuration

"lcov.branchCoverage": "off" or "simple" (default) or "full"

Branch coverage: A single boolean expression

exports.example = function (a) {
    if (a) {
        console.log('1');
    }
}

The above source code contains a single branch block consisting of two branches.

Test Code if taken else taken "simple" "full"
//no calls image image
example(1) image image
example(0) image image
example(0), example(1) image image

Branch coverage: A binary boolean expression

exports.example = function (a, b) {
    if (a && b) {
        console.log('1');
    }
}

For the table columns: * IF = if taken * ELSE = else taken * A? = a evaluated * B? = b evaluated

Test Code IF ELSE A? B? "simple" "full"
//no calls image image
example(0,0) image image
example(0,1) image image
example(1,0) image image
example(1,1) image image
example(0,0), example(0,1) image image
example(0,0), example(1,0) image image
example(0,0), example(1,1) image image
example(0,1), example(1,0) image image
example(0,1), example(1,1) image image
example(1,0), example(1,1) image image
example(0,0), example(0,1), example(1,0) image image
example(0,0), example(0,1), example(1,1) image image
example(0,0), example(1,0), example(1,1) image image
example(0,1), example(1,0), example(1,1) image image

Branch coverage: A ternary boolean expression

exports.example = function (a, b, c) {
    if (a && b && c) {
        console.log('1');
    }
}

For the table columns: * IF = if taken * ELSE = else taken * A? = a evaluated * B? = b evaluated * C? = c evaluated

Test Code IF ELSE A? B? C? "full"
//no calls image
example(0,0,0) image
example(1,0,0) image
example(1,1,0) image
example(1,1,1) image

Extension points exported contracts — how you extend this code

ICoverageData (Interface)
(no doc) [1 implementers]
src/loader.ts
ILineCoverageDecorations (Interface)
(no doc)
src/editorDecorator.ts
ISummary (Interface)
(no doc)
src/dataBank.ts
IRawOSWatchData (Interface)
(no doc)
src/configuration.ts
ICallbackFunc (Interface)
(no doc)
src/utils.ts
IWriteFunc (Interface)
(no doc)
src/logger.ts
IOriginalPosition (Interface)
(no doc)
src/sourceMapFinder.ts
ICacheEntry (Interface)
(no doc)
src/fileCache.ts

Core symbols most depended-on inside this repo

LOG
called by 8
src/logger.ts
enable
called by 5
src/sourceFileWatcher.ts
pushResult
called by 5
src/editorDecorator.ts
toPromiseFunc
called by 4
src/utils.ts
display
called by 4
src/statusIndicator.ts
bind
called by 4
src/logger.ts
testFizzBuzz
called by 4
examples/fizzbuzz/test.js
disable
called by 3
src/sourceFileWatcher.ts

Shape

Method 60
Function 32
Class 29
Interface 23
Enum 2

Languages

TypeScript100%

Modules by API surface

src/dataBank.ts29 symbols
src/configuration.ts15 symbols
src/sourceMapFinder.ts14 symbols
src/loader.ts13 symbols
src/editorDecorator.ts13 symbols
src/logger.ts10 symbols
src/statusIndicator.ts9 symbols
src/controller.ts9 symbols
src/sourceFileWatcher.ts7 symbols
src/utils.ts5 symbols
src/uriWatcher.ts5 symbols
src/coverageReportProvider.ts5 symbols

For agents

$ claude mcp add vscode-lcov \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page