Skip to content

Commit

Permalink
Attempt to get coverlet working, add more diagnostics to test runtime
Browse files Browse the repository at this point in the history
Work done for #196
  • Loading branch information
atruskie committed Mar 10, 2020
1 parent 6d38388 commit 1dad15c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build/azure-pipelines-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ jobs:
- task: DotNetCoreCLI@2
inputs:
command: test
nobuild: true
publishTestResults: true
projects: tests/Acoustics.Test/Acoustics.Test.csproj
arguments: >
--runtime $(rid)
--configuration $(configuration)
--settings tests/Acoustics.Test/.runsettings
--nobuild
--logger trx
--collect:"XPlat Code Coverage"
-- RunConfiguration.DisableAppDomain=true
Expand Down
3 changes: 2 additions & 1 deletion src/Acoustics.Shared/Json.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Json.cs" company="QutEcoacoustics">
// All code in this file and all associated files are the copyright and property of the QUT Ecoacoustics Research Group (formerly MQUTeR, and formerly QUT Bioacoustics Research Group).
// </copyright>
Expand All @@ -23,6 +23,7 @@ static Json()
Serializer = new JsonSerializer()
{
Formatting = Formatting.Indented,
PreserveReferencesHandling = PreserveReferencesHandling.All,
};
}

Expand Down
8 changes: 6 additions & 2 deletions tests/Acoustics.Test/Acoustics.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
Expand All @@ -16,9 +16,13 @@
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)..\..\src\AP.CopyFiles.targets" />
<ItemGroup>
<PackageReference Include="coverlet.collector" Version="1.2.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="FastMember" Version="1.5.0" />
<PackageReference Include="ImmediateReflection" Version="1.5.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.0-preview-20200309-01" />
<PackageReference Include="Moq" Version="4.13.1" />
<PackageReference Include="MSTest.TestAdapter" Version="2.1.0" />
<PackageReference Include="MSTest.TestFramework" Version="2.1.0" />
Expand Down
5 changes: 4 additions & 1 deletion tests/Acoustics.Test/TestHelpers/PathHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ namespace Acoustics.Test.TestHelpers
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using Acoustics.Shared;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Newtonsoft.Json;

public static class PathHelper
{
Expand Down Expand Up @@ -45,7 +47,8 @@ internal static void Initialize(TestContext context)

if (found < 0)
{
throw new InvalidOperationException($"Cannot find solution root directory in `{directory}`!");
var diagnostics = Json.SerializeToString(context, true, new JsonSerializerSettings {PreserveReferencesHandling = PreserveReferencesHandling.All });
throw new InvalidOperationException($"Cannot find solution root directory in `{directory}`!\n{diagnostics}");
}

SolutionRoot = split[..found].Join(pathDelimiter);
Expand Down

0 comments on commit 1dad15c

Please sign in to comment.