-
Notifications
You must be signed in to change notification settings - Fork 4.8k
/
xunit.console.targets
97 lines (84 loc) · 6.23 KB
/
xunit.console.targets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<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>
<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>
<RunScriptCommand Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">xunit.console.exe</RunScriptCommand>
<RunScriptCommand>$(RunScriptCommand) $(TargetFileName)</RunScriptCommand>
<RunScriptCommand>$(RunScriptCommand) -xml $(TestResultsName)</RunScriptCommand>
<RunScriptCommand>$(RunScriptCommand) -nologo</RunScriptCommand>
<RunScriptCommand Condition="'$(ArchiveTests)' == 'true'">$(RunScriptCommand) -nocolor</RunScriptCommand>
<RunScriptCommand Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework' and '$(TestDisableAppDomain)' == 'true'">$(RunScriptCommand) -noappdomain</RunScriptCommand>
<RunScriptCommand Condition="'$(TestDisableParallelization)' == 'true'">$(RunScriptCommand) -maxthreads 1</RunScriptCommand>
<RunScriptCommand Condition="'$(XUnitShowProgress)' == 'true'">$(RunScriptCommand) -verbose</RunScriptCommand>
</PropertyGroup>
<PropertyGroup Condition="'$(UseXunitExcludesTxtFile)' != 'true'">
<!-- Add local and global options to the argument stack. -->
<RunScriptCommand Condition="'$(XUnitMethodName)' != ''">$(RunScriptCommand) -method $(XUnitMethodName)</RunScriptCommand>
<RunScriptCommand Condition="'$(XUnitClassName)' != ''">$(RunScriptCommand) -class $(XUnitClassName)</RunScriptCommand>
<!-- Add to run argument string -->
<RunScriptCommand>$(RunScriptCommand)$(_withCategories.Replace(';', ' -trait category='))</RunScriptCommand>
<RunScriptCommand>$(RunScriptCommand)$(_withoutCategories.Replace(';', ' -notrait category='))</RunScriptCommand>
<!-- User passed in options. -->
<RunScriptCommand Condition="'$(XUnitOptions)' != ''">$(RunScriptCommand) $(XUnitOptions)</RunScriptCommand>
</PropertyGroup>
<PropertyGroup Condition="'$(UseXunitExcludesTxtFile)' == 'true'">
<XunitExcludesTxtFileContent>$(_withoutCategories.Replace(';', '%0dcategory='))</XunitExcludesTxtFileContent>
</PropertyGroup>
<PropertyGroup Condition="'$(TestSingleFile)' == 'true'">
<!-- Pass the results file -->
<RunScriptCommand>$(RunScriptCommand) -xml $(TestResultsName)</RunScriptCommand>
</PropertyGroup>
<ItemGroup Condition="'$(TestSingleFile)' != 'true'">
<PackageReference Include="Microsoft.DotNet.XUnitConsoleRunner"
Version="$(MicrosoftDotNetXUnitConsoleRunnerVersion)"
Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'" />
<PackageReference Include="xunit.runner.console"
Version="$(XUnitVersion)"
GeneratePathProperty="true"
Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'" />
</ItemGroup>
<!-- Overwrite the runner config file with the app local one. -->
<Target Name="OverwriteDesktopTestRunnerConfigs"
Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework' and
'$(GenerateAppConfigurationFile)' == 'true' and
'@(AppConfigWithTargetPath)' != ''"
AfterTargets="CopyFilesToOutputDirectory">
<ItemGroup>
<_testRunnerConfigDestFile Include="$(TargetDir)xunit.console.exe.config" />
</ItemGroup>
<Copy SourceFiles="@(AppConfigWithTargetPath)"
DestinationFiles="@(_testRunnerConfigDestFile)"
SkipUnchangedFiles="true" />
</Target>
<!-- ResolveAssemblyReferences is the target that populates ReferenceCopyLocalPaths which is what is copied to output directory. -->
<Target Name="CopyRunnerToOutputDirectory" BeforeTargets="ResolveAssemblyReferences" Condition="'$(TargetsMobile)' != 'true' or '$(BundleXunitRunner)' == 'true'">
<ItemGroup>
<!-- Copy test runner to output directory -->
<None Include="$([System.IO.Path]::GetDirectoryName('$(XunitConsole472Path)'))\*"
Exclude="$([System.IO.Path]::GetDirectoryName('$(XunitConsole472Path)'))\xunit.console.*exe.config;
$([System.IO.Path]::GetDirectoryName('$(XunitConsole472Path)'))\xunit.console.x86.exe;
$([System.IO.Path]::GetDirectoryName('$(XunitConsole472Path)'))\xunit.abstractions.dll"
Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework' and '$(XunitConsole472Path)' != ''"
CopyToOutputDirectory="PreserveNewest"
Visible="false" />
<_xunitConsoleNetCoreExclude Condition="'$(GenerateDependencyFile)' != 'true' and '$(XunitConsoleNetCore21AppPath)' != ''" Include="$([System.IO.Path]::GetDirectoryName('$(XunitConsoleNetCore21AppPath)'))\xunit.console.deps.json" />
<None Include="$([System.IO.Path]::GetDirectoryName('$(XunitConsoleNetCore21AppPath)'))\*"
Exclude="@(_xunitConsoleNetCoreExclude)"
Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and '$(XunitConsoleNetCore21AppPath)' != ''"
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>