Skip to content

Commit 53a83b0

Browse files
committed
refactor(TestTask): replace context warnings with ConsoleHelper methods for improved logging
1 parent 31f95c1 commit 53a83b0

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

build/LocalStack.Build/CakeTasks/TestTask.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,32 +17,31 @@ public override void Run(BuildContext context)
1717
string testProjectPath = testProj.CsProjPath;
1818
string targetFrameworks = string.Join(',', testProj.TargetFrameworks);
1919

20-
context.Warning($"Target Frameworks {targetFrameworks}");
20+
ConsoleHelper.WriteInfo($"Target Frameworks: {targetFrameworks}");
2121

2222
foreach (string targetFramework in testProj.TargetFrameworks)
2323
{
2424
if (context.SkipFunctionalTest && testProj.AssemblyName == "LocalStack.Client.Functional.Tests")
2525
{
26-
context.Warning("Skipping Functional Tests");
26+
ConsoleHelper.WriteWarning("Skipping Functional Tests");
2727

2828
continue;
2929
}
3030

31-
context.Warning(
32-
$"=============Running {targetFramework.ToUpper(System.Globalization.CultureInfo.CurrentCulture)} tests for {testProj.AssemblyName}=============");
31+
ConsoleHelper.WriteRule($"Running {targetFramework.ToUpper(System.Globalization.CultureInfo.CurrentCulture)} tests for {testProj.AssemblyName}");
3332
settings.Framework = targetFramework;
3433

3534
if (testProj.AssemblyName == "LocalStack.Client.Functional.Tests")
3635
{
37-
context.Warning("Deleting running docker containers");
36+
ConsoleHelper.WriteProcessing("Deleting running docker containers");
3837

3938
try
4039
{
4140
string psOutput = context.DockerPs(new DockerContainerPsSettings() { All = true, Quiet = true });
4241

4342
if (!string.IsNullOrEmpty(psOutput))
4443
{
45-
context.Warning(psOutput);
44+
ConsoleHelper.WriteInfo($"Found containers: {psOutput}");
4645

4746
string[] containers = psOutput.Split([Environment.NewLine], StringSplitOptions.None);
4847
context.DockerRm(containers);
@@ -60,14 +59,14 @@ public override void Run(BuildContext context)
6059
if (targetFramework == "net472" && !context.IsRunningOnWindows())
6160
{
6261
string platform = context.IsRunningOnLinux() ? "Linux (with external Mono)" : "macOS (built-in Mono)";
63-
context.Information($"Running .NET Framework tests on {platform}");
62+
ConsoleHelper.WriteInfo($"Running .NET Framework tests on {platform}");
6463
}
6564

6665
string testFilePrefix = targetFramework.Replace('.', '-');
6766
settings.ArgumentCustomization = args => args.Append($" --logger \"trx;LogFileName={testFilePrefix}_{testResults}\"");
6867
context.DotNetTest(testProjectPath, settings);
6968

70-
context.Warning("==============================================================");
69+
ConsoleHelper.WriteSuccess($"Completed {targetFramework} tests for {testProj.AssemblyName}");
7170
}
7271
}
7372
}

0 commit comments

Comments
 (0)