Skip to content

Commit

Permalink
Always use local vstest
Browse files Browse the repository at this point in the history
  • Loading branch information
bdukes committed Jan 30, 2021
1 parent 4151504 commit 65d1b1c
Showing 1 changed file with 12 additions and 24 deletions.
36 changes: 12 additions & 24 deletions Build/Cake/unit-tests.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using Cake.Common.IO;
using Cake.Common.Tools.MSBuild;
using System.Linq;

using Cake.Common.IO;
using Cake.Common.Tools.VSTest;
using Cake.Common.Tools.VSWhere;
using Cake.Common.Tools.VSWhere.Latest;
using Cake.Core.Diagnostics;
using Cake.Frosting;

/// <summary>
Expand All @@ -21,27 +19,17 @@ public override void Run(Context context)
testAssemblies -= context.GetFiles(@"**\DotNetNuke.Tests.Integration.dll");
testAssemblies -= context.GetFiles(@"**\DotNetNuke.Tests.Urls.dll");

var vsTestPath = context.GetFiles("tools/Microsoft.TestPlatform.16.8.0/tools/**/vstest.console.exe").First();
context.VSTest(
testAssemblies,
FixToolPath(
context,
new VSTestSettings
{
Logger = "trx",
Parallel = true,
EnableCodeCoverage = true,
TestAdapterPath = @"tools\NUnitTestAdapter.2.3.0\build"
}));
}

// https://github.com/cake-build/cake/issues/1522
VSTestSettings FixToolPath(Context context, VSTestSettings settings)
{
// #tool vswhere
settings.ToolPath =
context.VSWhereLatest(new VSWhereLatestSettings {Requires = "Microsoft.VisualStudio.PackageGroup.TestTools.Core"})
.CombineWithFilePath(context.File(@"Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe"));
return settings;
new VSTestSettings
{
ToolPath = vsTestPath,
Logger = "trx",
Parallel = true,
EnableCodeCoverage = true,
TestAdapterPath = @"tools\NUnitTestAdapter.2.3.0\build"
});
}
}

0 comments on commit 65d1b1c

Please sign in to comment.