Skip to content

Commit

Permalink
Improve the error when a project is using Microsoft.Testing.Platform
Browse files Browse the repository at this point in the history
Before:
> No test result reported. Make sure your test project contains test and is compatible with VsTest.No test detected for project '~/serilog-formatting-log4net/tests/Serilog.Formatting.Log4Net.Tests.csproj'. No cause identified.

After:
> No test result reported. Make sure your test project contains test and is compatible with VsTest.
> Project '~/serilog-formatting-log4net/tests/Serilog.Formatting.Log4Net.Tests.csproj' is using Microsoft.Testing.Platform which is not yet supported by Stryker, see stryker-mutator#3094
  • Loading branch information
0xced committed Jan 8, 2025
1 parent b801a6e commit 6e89519
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,8 @@ private InitialTestRun InitialTest(IStrykerOptions options, SourceProjectInfo pr
return result;
}

throw new InputException(
"No test result reported. Make sure your test project contains test and is compatible with VsTest." +
string.Join(Environment.NewLine, projectInfo.Warnings));
const string Message = "No test result reported. Make sure your test project contains test and is compatible with VsTest.";
throw new InputException(string.Join(Environment.NewLine, projectInfo.Warnings.Prepend(Message)));
}

private static readonly Dictionary<string, (string assembly, string package)> TestFrameworks = new()
Expand Down Expand Up @@ -207,6 +206,15 @@ private void DiscoverTests(SourceProjectInfo projectInfo, ITestRunner testRunner
_logger.LogWarning(message);
}

if (!causeFound && testProject.References.Any(r => r.Contains("Microsoft.Testing.Platform")))
{
causeFound = true;
var message = $"Project '{testProject.ProjectFilePath}' is using Microsoft.Testing.Platform which is not yet supported by Stryker, " +
$"see https://github.com/stryker-mutator/stryker-net/issues/3094";
projectInfo.LogError(message);
_logger.LogWarning(message);
}

if (causeFound)
{
continue;
Expand Down

0 comments on commit 6e89519

Please sign in to comment.