Skip to content

Commit 115da34

Browse files
committed
chore: update xunit version to v3
1 parent 445113c commit 115da34

File tree

39 files changed

+379
-95
lines changed

39 files changed

+379
-95
lines changed

.github/workflows/ci.yml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ on:
55
push:
66
branches: [ main, feature/*, hotfix/* ]
77
workflow_dispatch:
8+
inputs:
9+
seed:
10+
description: 'Enter an integer value between 0 and 2147483647.'
11+
type: number
12+
required: true
13+
default: 0
14+
15+
env:
16+
seed: ${{ inputs.seed || github.run_number }}
17+
NO_COLOR: true
818

919
jobs:
1020
test:
@@ -30,25 +40,28 @@ jobs:
3040
shell: bash
3141
working-directory: templates
3242

33-
- run: dotnet test -c Release -f net8.0 --no-build --collect:"XPlat Code Coverage" --consoleLoggerParameters:"Summary;Verbosity=Minimal"
43+
- name: Install Chromium headless shell
44+
run: dotnet run -c Release --no-build -f net8.0 --project src/docfx -- docs/docfx.json
45+
46+
- run: dotnet test -c Release -f net8.0 --no-build --collect:"XPlat Code Coverage" --consoleLoggerParameters:"Summary;Verbosity=Minimal" -- --seed ${{ env.seed }}
3447
id: test-net80
3548

36-
- run: dotnet test -c Release -f net9.0 --no-build --collect:"XPlat Code Coverage" --consoleLoggerParameters:"Summary;Verbosity=Minimal"
49+
- run: dotnet test -c Release -f net9.0 --no-build --collect:"XPlat Code Coverage" --consoleLoggerParameters:"Summary;Verbosity=Minimal" -- --seed ${{ env.seed }}
3750
if: matrix.os == 'ubuntu-latest'
3851
id: test-net90
3952

4053
- run: npm i -g @percy/cli
4154
if: matrix.os == 'ubuntu-latest'
4255

43-
- run: percy exec -- dotnet test -c Release -f net8.0 --filter Stage=Percy --no-build --collect:"XPlat Code Coverage"
56+
- run: percy exec -- dotnet test -c Release -f net8.0 --no-build --collect:"XPlat Code Coverage" -- --filter-trait "Stage=Percy"
4457
if: matrix.os == 'ubuntu-latest'
4558
env:
4659
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
4760

4861
- uses: codecov/codecov-action@v5
4962
if: matrix.os == 'ubuntu-latest'
5063
with:
51-
fail_ci_if_error: true
64+
fail_ci_if_error: false
5265

5366
- run: echo "DOTNET_DbgEnableMiniDump=1" >> $GITHUB_ENV
5467
if: matrix.os == 'ubuntu-latest'
@@ -68,8 +81,10 @@ jobs:
6881
name: logs-${{ matrix.os }}
6982
path: |
7083
msbuild.binlog
84+
test/**/TestResults/*.log
7185
test/**/TestResults/*.trx
7286
test/**/TestResults/*.html
87+
test/**/TestResults/*.ctrf
7388
7489
- uses: actions/upload-artifact@v4
7590
if: ${{ failure() && matrix.os == 'ubuntu-latest' }}

docfx.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{926A0726-B
1616
ProjectSection(SolutionItems) = preProject
1717
test\Directory.Build.props = test\Directory.Build.props
1818
test\Directory.Packages.props = test\Directory.Packages.props
19+
test\xunit.runner.json = test\xunit.runner.json
1920
EndProjectSection
2021
EndProject
2122
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "docfx", "src\docfx\docfx.csproj", "{EF53214F-BA98-4026-BEED-CF771865C312}"

samples/Directory.Packages.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<Project>
2+
</Project>

samples/seed/dotnet/assembly/BuildFromAssembly.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</PropertyGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="Microsoft.SourceLink.GitHub">
13+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
1414
<PrivateAssets>all</PrivateAssets>
1515
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
1616
</PackageReference>

test/Directory.Build.props

Lines changed: 51 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,74 @@
11
<Project>
2+
<Import Project="$([MSBuild]::GetPathOfFileAbove('$(MSBuildThisFile)', '$(MSBuildThisFileDirectory)../'))" />
3+
24
<PropertyGroup>
35
<IsPackable>false</IsPackable>
46
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
57
</PropertyGroup>
68

9+
<!-- .NET 9 or later run tests per TargetFramework in parallel by default.
10+
It is necessary to disable this feature because there are tests that need to be executed sequentially that are marked with `[Collection("docfx STA")]`. -->
711
<PropertyGroup>
8-
<!--
9-
.NET 9 preview 2 or later run tests in parallel by default.
10-
It is necessary to disable this feature because there are tests that need to be executed sequentially that are marked with `[Collection("docfx STA")]`.
11-
-->
1212
<TestTfmsInParallel>false</TestTfmsInParallel>
1313
</PropertyGroup>
1414

15-
<Import Project="$([MSBuild]::GetPathOfFileAbove('$(MSBuildThisFile)', '$(MSBuildThisFileDirectory)../'))" />
15+
<!-- Configure `Microsoft.Testing.Platform` mode behaviors (https://learn.microsoft.com/en-us/dotnet/core/testing/unit-testing-platform-integration-dotnet-test)-->
16+
<PropertyGroup>
17+
<!-- Enable `Microsoft.Testing.Platform` mode for `dotnet test` -->
18+
<TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
1619

17-
<ItemGroup>
18-
<None Include="TestData\**" CopyToOutputDirectory="PreserveNewest" />
19-
</ItemGroup>
20+
<!-- Show failure per test -->
21+
<TestingPlatformShowTestsFailure>true</TestingPlatformShowTestsFailure>
22+
23+
<!-- Show complete platform output -->
24+
<TestingPlatformCaptureOutput>false</TestingPlatformCaptureOutput>
25+
26+
<!-- Use `Microsoft.Testing.Platform` entrypoint. -->
27+
<UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner>
28+
29+
<!-- Change TestResults output directory. And enable detailed log outputs -->
30+
<TestingPlatformCommandLineArguments>$(TestingPlatformCommandLineArguments) --results-directory "$(MSBuildThisFileDirectory)TestResults"</TestingPlatformCommandLineArguments>
31+
32+
<!-- Ignore exit code 8 (the test session run zero tests) -->
33+
<TestingPlatformCommandLineArguments>$(TestingPlatformCommandLineArguments) --ignore-exit-code 8</TestingPlatformCommandLineArguments>
34+
</PropertyGroup>
2035

36+
<!-- Settings for CI environment -->
2137
<PropertyGroup Condition="'$(ContinuousIntegrationBuild)' == 'true' AND '$(PERCY_TOKEN)' == ''">
38+
<!-- Disable progress reports -->
39+
<TestingPlatformCommandLineArguments>$(TestingPlatformCommandLineArguments) --no-progress</TestingPlatformCommandLineArguments>
40+
41+
<!-- Enable trx/html reporters -->
42+
<TestingPlatformCommandLineArguments>$(TestingPlatformCommandLineArguments) --report-xunit-trx --report-xunit-trx-filename TestResults-$(MSBuildProjectName)-$(TargetFramework)-$(RUNNER_OS).trx</TestingPlatformCommandLineArguments>
43+
<TestingPlatformCommandLineArguments>$(TestingPlatformCommandLineArguments) --report-xunit-html --report-xunit-html-filename TestResults-$(MSBuildProjectName)-$(TargetFramework)-$(RUNNER_OS).html</TestingPlatformCommandLineArguments>
44+
<TestingPlatformCommandLineArguments>$(TestingPlatformCommandLineArguments) --report-ctrf --report-ctrf-filename TestResults-$(MSBuildProjectName)-$(TargetFramework)-$(RUNNER_OS).ctrf</TestingPlatformCommandLineArguments>
45+
</PropertyGroup>
46+
47+
<!-- Settings for VSTest mode. These settings will be removed in future. -->
48+
<PropertyGroup Condition="'$(ContinuousIntegrationBuild)' == 'true' AND '$(PERCY_TOKEN)' == ''">
49+
<!-- See: https://learn.microsoft.com/en-us/dotnet/core/testing/unit-testing-platform-vs-vstest#communication-protocol-preview -->
2250
<VSTestResultsDirectory>$(MSBuildThisFileDirectory)TestResults</VSTestResultsDirectory>
2351
<VSTestLogger>$(VSTestLogger);trx%3BLogFileName=TestResults-$(MSBuildProjectName)-$(TargetFramework)-$(RUNNER_OS).trx</VSTestLogger>
2452
<VSTestLogger>$(VSTestLogger);html%3BLogFileName=TestResults-$(MSBuildProjectName)-$(TargetFramework)-$(RUNNER_OS).html</VSTestLogger>
2553
</PropertyGroup>
2654

55+
<!-- Add [assembly:CaptureConsole] attribute to assemblies -->
56+
<ItemGroup>
57+
<AssemblyAttribute Include="Xunit.CaptureConsole" />
58+
</ItemGroup>
59+
60+
<ItemGroup>
61+
<None Include="TestData\**" CopyToOutputDirectory="PreserveNewest" />
62+
<None Include="$(MSBuildThisFileDirectory)xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
63+
</ItemGroup>
64+
2765
<ItemGroup>
2866
<PackageReference Include="FluentAssertions" />
2967
<PackageReference Include="Microsoft.NET.Test.Sdk" />
30-
<PackageReference Include="xunit.runner.visualstudio" />
31-
<PackageReference Include="xunit" />
68+
<PackageReference Include="xunit.runner.visualstudio">
69+
<PrivateAssets>all</PrivateAssets>
70+
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
71+
</PackageReference>
72+
<PackageReference Include="xunit.v3" />
3273
</ItemGroup>
3374
</Project>

test/Directory.Packages.props

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
<?xml version="1.0" encoding="utf-8" ?>
21
<Project>
32
<Import Project="$([MSBuild]::GetPathOfFileAbove('$(MSBuildThisFile)', '$(MSBuildThisFileDirectory)../'))" />
43

54
<ItemGroup>
65
<PackageVersion Include="FluentAssertions" Version="7.0.0" />
76
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
87
<PackageVersion Include="Verify.DiffPlex" Version="3.1.2" />
9-
<PackageVersion Include="Verify.Xunit" Version="28.4.0" />
10-
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
11-
<PackageVersion Include="xunit" Version="2.9.2" />
8+
<PackageVersion Include="Verify.XunitV3" Version="28.6.0" />
9+
<PackageVersion Include="xunit.runner.visualstudio" Version="3.0.0" />
10+
<PackageVersion Include="xunit.v3" Version="1.0.0" />
1211
</ItemGroup>
1312

1413
<ItemGroup>

test/Docfx.Build.Common.Tests/Docfx.Build.Common.Tests.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<OutputType>Exe</OutputType>
4+
</PropertyGroup>
5+
26
<ItemGroup>
37
<ProjectReference Include="..\..\src\Docfx.Build.Common\Docfx.Build.Common.csproj" />
48
<ProjectReference Include="..\..\src\Docfx.Build\Docfx.Build.csproj" />

test/Docfx.Build.ManagedReference.Tests/Docfx.Build.ManagedReference.Tests.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<OutputType>Exe</OutputType>
4+
</PropertyGroup>
5+
26
<ItemGroup>
37
<ProjectReference Include="..\..\src\Docfx.Build\Docfx.Build.csproj" />
48
<ProjectReference Include="..\..\src\Docfx.Build.ManagedReference\Docfx.Build.ManagedReference.csproj" />

test/Docfx.Build.OverwriteDocuments.Tests/Docfx.Build.OverwriteDocuments.Tests.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<OutputType>Exe</OutputType>
4+
</PropertyGroup>
5+
26
<ItemGroup>
37
<PackageReference Include="Markdig" />
48
</ItemGroup>
9+
510
<ItemGroup>
611
<ProjectReference Include="..\..\src\Docfx.Build.OverwriteDocuments\Docfx.Build.OverwriteDocuments.csproj" />
712
<ProjectReference Include="..\Docfx.Tests.Common\Docfx.Tests.Common.csproj" />

test/Docfx.Build.RestApi.Tests/Docfx.Build.RestApi.Tests.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<OutputType>Exe</OutputType>
4+
</PropertyGroup>
5+
26
<ItemGroup>
37
<None Include="TestData\**" CopyToOutputDirectory="PreserveNewest" />
48
</ItemGroup>

0 commit comments

Comments
 (0)