Skip to content

Commit

Permalink
Set xunit env var to not print output for passing tests (#105392)
Browse files Browse the repository at this point in the history
* Set xunit env var to not print output for passing tests

Fixes #103445

* Update xunit.console.targets

* Update xunit.console.targets
  • Loading branch information
ViktorHofer committed Jul 25, 2024
1 parent 86cb7b9 commit 72c9b85
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
4 changes: 4 additions & 0 deletions eng/testing/.runsettings
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
<!-- Filter out failing (wrong framwork, platform, runtime or activeissue) tests -->
<TestCaseFilter>$$TESTCASEFILTER$$</TestCaseFilter>
<DotNetHostPath>$$DOTNETHOSTPATH$$</DotNetHostPath>
<EnvironmentVariables>
<!-- Configures xunit to not print out passing tests with output when diagnostic messages are enabled. -->
<XUNIT_HIDE_PASSING_OUTPUT_DIAGNOSTICS>1</XUNIT_HIDE_PASSING_OUTPUT_DIAGNOSTICS>
</EnvironmentVariables>
</RunConfiguration>
<LoggerRunSettings>
<Loggers>
Expand Down
16 changes: 8 additions & 8 deletions eng/testing/xunit/xunit.console.targets
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
<Project>

<PropertyGroup>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<TestResultsName>testResults.xml</TestResultsName>
<UseXunitExcludesTxtFile Condition="'$(TargetOS)' == 'android' or '$(TargetOS)' == 'ios' or '$(TargetOS)' == 'iossimulator' or '$(TargetOS)' == 'tvos' or '$(TargetOS)' == 'tvossimulator' or '$(TargetOS)' == 'maccatalyst'">true</UseXunitExcludesTxtFile>
</PropertyGroup>

<ItemGroup>
<!-- Configures xunit to not print out passing tests with output when diagnostic messages are enabled. -->
<SetScriptCommands Condition="'$(TargetOS)' == 'windows'" Include="set XUNIT_HIDE_PASSING_OUTPUT_DIAGNOSTICS=1" />
<SetScriptCommands Condition="'$(TargetOS)' != 'windows'" Include="export XUNIT_HIDE_PASSING_OUTPUT_DIAGNOSTICS=1" />
</ItemGroup>

<PropertyGroup Condition="'$(TargetsMobile)' != 'true' and '$(TestSingleFile)' != 'true'">
<_depsFileArgument Condition="'$(GenerateDependencyFile)' == 'true'">--depsfile $(AssemblyName).deps.json</_depsFileArgument>
<RunScriptCommand Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'">"$(RunScriptHost)" exec --runtimeconfig $(AssemblyName).runtimeconfig.json $(_depsFileArgument) xunit.console.dll</RunScriptCommand>
Expand Down Expand Up @@ -85,13 +92,6 @@
CopyToOutputDirectory="PreserveNewest"
Visible="false" />
</ItemGroup>

<!-- Workaround for https://github.com/xunit/xunit/issues/1651 -->
<ItemGroup Condition="'$(ArchiveTests)' != 'true'">
<None Remove="$(Pkgxunit_runner_visualstudio)\build\net452\xunit.runner.utility.net452.dll" />
<None Remove="$(Pkgxunit_runner_visualstudio)\build\net452\xunit.runner.reporters.net452.dll" />
<None Remove="$(Pkgxunit_runner_visualstudio)\build\netcoreapp2.1\xunit.runner.utility.netcoreapp10.dll" />
<None Remove="$(Pkgxunit_runner_visualstudio)\build\netcoreapp2.1\xunit.runner.reporters.netcoreapp10.dll" />
</ItemGroup>
</Target>

</Project>

0 comments on commit 72c9b85

Please sign in to comment.