Skip to content

Commit 72c9b85

Browse files
authored
Set xunit env var to not print output for passing tests (#105392)
* Set xunit env var to not print output for passing tests Fixes #103445 * Update xunit.console.targets * Update xunit.console.targets
1 parent 86cb7b9 commit 72c9b85

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

eng/testing/.runsettings

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
<!-- Filter out failing (wrong framwork, platform, runtime or activeissue) tests -->
1919
<TestCaseFilter>$$TESTCASEFILTER$$</TestCaseFilter>
2020
<DotNetHostPath>$$DOTNETHOSTPATH$$</DotNetHostPath>
21+
<EnvironmentVariables>
22+
<!-- Configures xunit to not print out passing tests with output when diagnostic messages are enabled. -->
23+
<XUNIT_HIDE_PASSING_OUTPUT_DIAGNOSTICS>1</XUNIT_HIDE_PASSING_OUTPUT_DIAGNOSTICS>
24+
</EnvironmentVariables>
2125
</RunConfiguration>
2226
<LoggerRunSettings>
2327
<Loggers>

eng/testing/xunit/xunit.console.targets

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
<Project>
2+
23
<PropertyGroup>
34
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
45
<TestResultsName>testResults.xml</TestResultsName>
56
<UseXunitExcludesTxtFile Condition="'$(TargetOS)' == 'android' or '$(TargetOS)' == 'ios' or '$(TargetOS)' == 'iossimulator' or '$(TargetOS)' == 'tvos' or '$(TargetOS)' == 'tvossimulator' or '$(TargetOS)' == 'maccatalyst'">true</UseXunitExcludesTxtFile>
67
</PropertyGroup>
78

9+
<ItemGroup>
10+
<!-- Configures xunit to not print out passing tests with output when diagnostic messages are enabled. -->
11+
<SetScriptCommands Condition="'$(TargetOS)' == 'windows'" Include="set XUNIT_HIDE_PASSING_OUTPUT_DIAGNOSTICS=1" />
12+
<SetScriptCommands Condition="'$(TargetOS)' != 'windows'" Include="export XUNIT_HIDE_PASSING_OUTPUT_DIAGNOSTICS=1" />
13+
</ItemGroup>
14+
815
<PropertyGroup Condition="'$(TargetsMobile)' != 'true' and '$(TestSingleFile)' != 'true'">
916
<_depsFileArgument Condition="'$(GenerateDependencyFile)' == 'true'">--depsfile $(AssemblyName).deps.json</_depsFileArgument>
1017
<RunScriptCommand Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'">"$(RunScriptHost)" exec --runtimeconfig $(AssemblyName).runtimeconfig.json $(_depsFileArgument) xunit.console.dll</RunScriptCommand>
@@ -85,13 +92,6 @@
8592
CopyToOutputDirectory="PreserveNewest"
8693
Visible="false" />
8794
</ItemGroup>
88-
89-
<!-- Workaround for https://github.com/xunit/xunit/issues/1651 -->
90-
<ItemGroup Condition="'$(ArchiveTests)' != 'true'">
91-
<None Remove="$(Pkgxunit_runner_visualstudio)\build\net452\xunit.runner.utility.net452.dll" />
92-
<None Remove="$(Pkgxunit_runner_visualstudio)\build\net452\xunit.runner.reporters.net452.dll" />
93-
<None Remove="$(Pkgxunit_runner_visualstudio)\build\netcoreapp2.1\xunit.runner.utility.netcoreapp10.dll" />
94-
<None Remove="$(Pkgxunit_runner_visualstudio)\build\netcoreapp2.1\xunit.runner.reporters.netcoreapp10.dll" />
95-
</ItemGroup>
9695
</Target>
96+
9797
</Project>

0 commit comments

Comments
 (0)