Skip to content

Commit

Permalink
Switching to dotnet test runner to get rid of exceptions during cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
batzen committed Jan 4, 2020
1 parent 98d5beb commit 8ece6e2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
3 changes: 3 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ build_script:
- ps: .\build.ps1 --bootstrap
- ps: .\build.ps1 -target appveyor

after_build:
- ps: gci -Filter *.trx -Path .\TestResults\ | % { (New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/mstest/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $_.FullName)) }

artifacts:
- path: \Publish\*.*

Expand Down
20 changes: 15 additions & 5 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ if (FileExists(msBuildPathExe) == false)
// Directories and Paths
var solution = "./src/MahApps.Metro.sln";
var publishDir = "./Publish";
var testResultsDir = Directory("./TestResults");

///////////////////////////////////////////////////////////////////////////////
// SETUP / TEARDOWN
Expand Down Expand Up @@ -108,7 +109,7 @@ Task("Build")
Verbosity = verbosity
, ToolPath = msBuildPathExe
, Configuration = configuration
, ArgumentCustomization = args => args.Append("/m").Append("/nr:false") // The /nr switch tells msbuild to quite once its done
, ArgumentCustomization = args => args.Append("/m").Append("/nr:false") // The /nr switch tells msbuild to quite once its done
, BinaryLogger = new MSBuildBinaryLogSettings() { Enabled = isLocal }
};
MSBuild(solution, msBuildSettings
Expand Down Expand Up @@ -315,10 +316,19 @@ Task("Tests")
.ContinueOnError()
.Does(() =>
{
XUnit2(
"./src/Mahapps.Metro.Tests/bin/" + configuration + "/**/*.Tests.dll",
new XUnit2Settings { ToolTimeout = TimeSpan.FromMinutes(5) }
);
CleanDirectory(testResultsDir);

var settings = new DotNetCoreTestSettings
{
Configuration = configuration,
NoBuild = true,
NoRestore = true,
Logger = "trx",
ResultsDirectory = testResultsDir,
Verbosity = DotNetCoreVerbosity.Normal
};

DotNetCoreTest("./src/Mahapps.Metro.Tests/Mahapps.Metro.Tests.csproj", settings);
});

Task("CreateRelease")
Expand Down

0 comments on commit 8ece6e2

Please sign in to comment.