Skip to content

Commit

Permalink
ci: Flag UnitTest coverage with unit-tests in Codecov
Browse files Browse the repository at this point in the history
This is in preparation for upcoming Functional Testing which ideally I want to be able to filter in Codecov.
  • Loading branch information
DrBarnabus committed Apr 22, 2024
1 parent 475eba2 commit 761a256
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 3 additions & 2 deletions build/Build/Tasks/Testing/PublishCoverage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public override bool ShouldRun(BuildContext context)

public override void Run(BuildContext context)
{
string[] coverageFiles = context.GetFiles($"{Paths.TestResults}/*.coverage.xml")
string[] coverageFiles = context.GetFiles($"{Paths.TestResults}/*.UnitTests.*.coverage.xml")
.Select(f => context.MakeRelative(f).ToString())
.ToArray();

Expand All @@ -32,7 +32,8 @@ public override void Run(BuildContext context)
context.Codecov(new CodecovSettings
{
Files = coverageFiles,
Token = token
Token = token,
Flags = "unit-tests"
});
}
}
3 changes: 1 addition & 2 deletions build/Build/Tasks/Testing/UnitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ public override void OnError(Exception exception, BuildContext context)
private static void TestProjectForTarget(BuildContext context, FilePath project, string targetFramework)
{
string projectName = $"{project.GetFilenameWithoutExtension()}.{targetFramework}";
var testResultsPath = context.MakeAbsolute(Paths.TestResults.CombineWithFilePath(
$"{projectName}.results.xml"));
var testResultsPath = context.MakeAbsolute(Paths.TestResults.CombineWithFilePath($"{projectName}.results.xml"));

var settings = new DotNetTestSettings
{
Expand Down

0 comments on commit 761a256

Please sign in to comment.