Created
September 12, 2019 13:45
-
-
Save samuell/ac50d78feb6571dcb57218bcddcf979e to your computer and use it in GitHub Desktop.
Example Makefile for building a coverage report for .Net Core 2.2 projects on Windows 10 in MSYS2/Bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# -------------------------------------------------------------------------------- | |
# This script uses the coverlet tool to generate code coverage statistics about the tests | |
# For more info about coverlet: https://github.com/tonerdo/coverlet | |
# Author: Samuel Lampa | |
# -------------------------------------------------------------------------------- | |
./bin/Debug/netcoreapp2.2/MyApp.Tests.dll: | |
echo "Installing any uninstalled dependencies, by executing dotnet restore ..." | |
dotnet restore | |
dotnet build | |
coverage.opencover.xml: ./bin/Debug/netcoreapp2.2/MyApp.Tests.dll | |
coverlet $< --target dotnet --targetargs "test --no-build" --format opencover; | |
covreport/index.htm: coverage.opencover.xml | |
/c/Users/${USER}/.nuget/packages/reportgenerator/4.0.14/tools/net47/ReportGenerator.exe "-reports:$<" "-targetdir:covreport" "-reporttypes:Html"; | |
build-covxml: coverage.opencover.xml | |
build-coverage: covreport/index.htm | |
show-coverage: covreport/index.htm | |
echo "Now trying to open the report in the Brave browser (if it doesn't work, you probably don't have Brave installed)"; | |
/c/Program\ Files\ \(x86\)/BraveSoftware/Brave-Browser/Application/brave.exe "$<" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment