Skip to content

Instantly share code, notes, and snippets.

@tech-andgar
Last active October 13, 2021 13:56
Show Gist options
  • Select an option

  • Save tech-andgar/7e9e5713b5821fa0f674f9a9dd880d2a to your computer and use it in GitHub Desktop.

Select an option

Save tech-andgar/7e9e5713b5821fa0f674f9a9dd880d2a to your computer and use it in GitHub Desktop.
LCOV in Windows

LCOV in Windows

Required:

* Chocolatey
* Perl
* LCOV

INSTRUCTIONS

CHOCOLATEY

  1. Install choco

    Run Get-ExecutionPolicy. If it returns Restricted, then run Set-ExecutionPolicy AllSigned or Set-ExecutionPolicy Bypass -Scope Process

    • CMD (With Admin)
    @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
    • POWERSHELL (With Admin)
    Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

PERL

  1. Install Perl

    choco install strawberryperl
  2. Check Installed Perl

    where perl

    OUTPUT CORRECT:

    # C:\Strawberry\perl\bin\perl.exe

    If not exist, add path perl on system environment variables

    Note: A command that changes cmd's environment variables only for the current cmd session

    set PATH=$PATH:C:\Strawberry\perl\bin
    
    echo %path%

    If want You can permanently add a path to PATH with the setx command:

    Warnings

    1. Backup your PATH - SETX will truncate your junk longer than 1024 characters
    2. Don't call SETX %PATH%;xxx - adds the system path into the user path (SETX by default will update your user path.)
    3. Don't call SETX %PATH%;xxx /M - adds the user path into the system path (SETX ... /M will update your system path.)
    setx /M path "%path%;C:\Strawberry\perl\bin\"
    
    echo %path%

LCOV

  1. Install LCOV

    choco install lcov
  2. Run tests of project Flutter

    flutter test --coverage
  3. Generate coverage files and convert to HTML

    CMD or PowerShell

    perl C:\ProgramData\chocolatey\lib\lcov\tools\bin\genhtml coverage/lcov.info -o coverage/html

    Git bash

    perl /c/ProgramData/chocolatey/lib/lcov/tools/bin/genhtml coverage/lcov.info -o coverage/html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment