Coder Social home page Coder Social logo

ryanluker / vscode-coverage-gutters Goto Github PK

View Code? Open in Web Editor NEW
442.0 10.0 89.0 28.32 MB

Display test coverage generated by lcov and xml - works with many languages

Home Page: https://marketplace.visualstudio.com/items?itemName=ryanluker.vscode-coverage-gutters

License: MIT License

TypeScript 80.44% JavaScript 1.62% Python 0.27% PHP 1.18% Java 8.85% HTML 3.33% Dockerfile 0.62% Shell 0.05% Ruby 3.26% C# 0.38%
test-coverage coverage-gutters lcov vscode-extension visual-studio-code

vscode-coverage-gutters's Introduction

coverage-gutters

Display test coverage generated by lcov or xml in your editor.

Call for Maintainers

Looking for helpful people to assist with bugs, new features or performance improvements.
The project has a full suite of tests and code linting, making it very new contributor friendly.
Take a look at some of the open github issues and see if any catch your eye!
https://github.com/ryanluker/vscode-coverage-gutters/issues

Features

Coverage Gutters features watch

  • Supports any language as long as you can generate a lcov style coverage file
  • Extensive logging and insight into operations via the output logs
  • Multi coverage file support for both xml and lcov
  • Coverage caching layer makes for speedy rendering even in large files
  • Relative coverage file resolution for those with complex file paths
  • Preview coverage reports inside the editor
  • Huge amount of workspace settings to customize the features to your liking
  • Colour compatibility with light and dark themes
  • Custom coverage paths with a hot swapping feature for remote builds

Common Commands

Watch (activated via command palette or shortcut icon on the status bar): Activating watch allows the extension to keep track of coverage changes and update its cache. It also will automatically apply coverage to a file if some exists.

Display (activated via command palette or shortcut key): Displays coverage for the current activated file only, does not update if the coverage files change.

Preview Report (activated via command palette): Shows you a html preview of your coverage reports in your editor.

Officially Supported Languages (Backed by tests ran nightly)

See examples directory on how to setup a project.

Tips and Tricks

Using Breakpoints: Currently to both use the extension and code debugging breakpoints, you need to disable the gutter coverage and enable the line coverage via the settings ( coverage-gutters.showGutterCoverage and coverage-gutters.showLineCoverage respectively).

Requirements

  • vscode 1.27.0 and up
  • macos, linux or windows
  • Requires Live Preview extension
    • vscode extension id: ms-vscode.live-server
    • v0.2.12 or higher

Extension Settings

See extension setting options in IDE.

Known Issues

Release Notes

Contribution Guidelines

About the Maintainers

If you are interested in what else we work on, checkout the maintainers below!
https://luker.dev
https://github.com/mattseddon
https://github.com/timagixe
https://www.spodymek.com/
https://www.kayode.tech/
https://huddleco.com.au/


Icon made by Dave Gandy from www.flaticon.com is licensed by CC 3.0 BY

vscode-coverage-gutters's People

Contributors

amatosov-rbx avatar aussidavid avatar brandongk avatar cceckman avatar chcap avatar dependabot[bot] avatar dw8reaper avatar ermshiperete avatar felipecaputo avatar flatrick avatar flatrick-priv avatar justarandomgeek avatar kaltepeter avatar kaytbode avatar kh2se2013 avatar mattseddon avatar openningia avatar oscargus avatar pdfowler avatar ryanluker avatar sethfalco avatar sfc-gh-wzhao avatar spodym avatar ssbarnea avatar tadaboody avatar timagixe avatar timthelion avatar vxdguy avatar webmaster777 avatar wenbei avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-coverage-gutters's Issues

Fix changelog link

changelog link should point to github releases (there already is a changelog link in the marketplace)

Add ability to interpet WSL file paths

I'm using VSCode under Windows, but the actual code runs under Linux, hence the tests etc. also run under Linux (via WSL).

Unfortunately this means that the paths in lcov.info are like /mnt/c/Users/david/proj/myProject/myFile.js and your extension says "no coverage for file" for every file because it probably looks for C:\Users\david\proj\myProject\myFile.js instead.

Would it be possible to automatically convert the path (if it starts with /mnt) so that it can find the file?

investigate code coverage missing on complex lines of code

Overview:

when making function calls then assigning to a variable via await async function and see that there is no coverage (ts)

Notes:

  • could not reproduce locally with javascript and complex function returns
  • debugged indicators function when applying coverage to more complex typescript await code. -
  • Saw the issue then which produced lcov lines that looked like they were missing entries for the function calls before the await.
  • most likely an istanbul issue or issue related to nyc setup locally (personal) after looking into the lcov.info file and seeing no coverage details for the lines in question (have to be covered as code directly afterwords is covered...)

Auto render coverage when opening a file

  • When lcov watch is active, auto render coverage for the file being opened.
  • If a file does not have coverage do not display error message (make configurable?) as this may become annoying as you open files that do not have lcov coverage.
  • Consider having watch lcov and watch files be seperate actions

Use relative path compare by default

Relative path compare is a good choice for default true as it rides a good balance between too costly performance wise and needed bridging for WSL users

Unreliable lcov rendering if more then one lcov file per workspace

Reproduce:

  • add more then one lcov
  • display coverage
  • see that sometimes you get no or incorrect coverage
  • watch coverage
  • see that sometimes you do not get updates or updated with incorrect coverage

solution:

  • add metric to capture occurences
  • add check for lcov find > 1

vscode 1.11.x doesnt seem to properly remove editors from active array

reproduce:

  • add coverage to editors
  • close editors or navigate away
  • regenerate the lcov file
  • see warning messages in debug log about editor having been disposed
  • no user facing issues other then editor array not being cleaned up

code:

Seems to be a change in the disposal pattern for the editors in the 1.11.x release, when debugging the problem it seems as if the wrong conditional flow is happening for the editors that have been disposed. https://github.com/ryanluker/vscode-coverage-gutters/blob/master/src/gutters.ts#L61

work:

  • Find adaptable work around or increment min version to 1.11.x
  • (optional) Add metric to capture vscode version

Can't find lcov.info if it's excluded from the VSCode project

Great plugin – now that I got it working!

I spent the first 10 minutes fighting with it - reloading, reinstalling, changing config settings.

Then I realized the problem might be that the lcov.info is in an excluded path. (I exclude my coverage folder so the hundreds of generated HTML files – one per source file – don't clog up my search results)

{
    "files.exclude": {
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": true,
        "**/CVS": true,
        "**/.DS_Store": true,
        "dist-*/**": true,
        "coverage/**": true
    }
}

I've found a workaround:

        "coverage/{server,shared,client,lcov-report}/**": true

But it would be nice if I didn't have to do this!

Ability to read relative paths?

A quick question: is it possible to use relative file paths in the LCOV file?

I didn't find any VS Code coverage extension allowing for relative paths, and I'm desperately looking for that, for my development tools to be completely on the server/container side.

Rendering coverage when the editor does not have a document throws error

Based on GA users are seeing this error in 1.0

Cannot read property 'document' of undefined

related to the below code:

private async loadAndRenderCoverage(textEditor: TextEditor, lcovPath: string): Promise<void> {
        const lcovFile = await this.lcov.load(lcovPath);
        const file = textEditor.document.fileName;
        const coveredLines = await this.indicators.extract(lcovFile, file);
        await this.indicators.renderToTextEditor(coveredLines, textEditor);
    }

    private renderCoverageOnVisible(lcovPath: string) {
        window.visibleTextEditors.forEach(async (editor) => {
            if (!editor) { return; }
            await this.loadAndRenderCoverage(editor, lcovPath);
        });
    }

check for editor.document in the caller should be suffice (should not return error but simple not try to render coverage for a null document)

Add GA tracking id as env variable to help release process

  • remove metrics from config and customConfig (gathered enough data to know not many use the custom options except altSFCompare, will still support customization though for personal use 😄 )
  • add metric for coverage rending
  • add process env variable for the GA tracking ID

Add support for rendering "uncovered" lines as red.

I'm currently integrating go coverage with lcov and this extension and it's pretty dope.

image

Go coverage is slightly different to other coverage systems and only marks "start statements" as covered instead of the "entire statement"

My code coverage (istanbul) UI renders this as a HTML page

image

Notice how there are some lines that have no hits, like method signatures ( but also, not in screenshot, interface and struct declrations also have 'no coverage' because they are declerations.

It would be really nice if detail.hit === 0 ( aka this statement is not covered ) that we somehow mark that line as "red" or some other color theme in vs code.

This would mean having two renderLines array, one for "covered" and one for "uncovered" and then setting decorations for both types of coverage information.

I find that scanning through a file for "red lines" is a lot easier then scanning through a file for "not highlighted" lines because a lot of the "not highlighted" lines look like this :

image

Everything in that screenshot is actually covered but it takes some visual processing to double check that.

Add telemetry to better understand usage and errors

Work:

Value:

  • metrics would allow insight into:
    • what features users are using
    • amount of users taking advantage of the customization options
    • what errors are occurring

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.