-
Notifications
You must be signed in to change notification settings - Fork 142
xUnit v3 upgrade #960
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
xUnit v3 upgrade #960
Changes from 19 commits
4e9036e
7236d38
303a76f
c6b19fc
1e4e20d
ac50650
9441794
ef89379
e66de71
51e57ba
f3ff1ff
df16921
1ac2ad3
5840c2e
dcfbd73
102aaab
733964b
f10b449
425a39e
58b4b33
270aa58
cb145d8
31b4c71
d319e2f
587cace
874567a
837d9ef
db83468
6d7a778
239aca3
0ab87ce
70133ad
f925398
d7d256d
8273771
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,7 @@ on: | |
| - "v*" | ||
|
|
||
| env: | ||
| DEFAULT_DOTNET_VERSION: "8.0.x" | ||
| DEFAULT_DOTNET_VERSION: "10.0.x" | ||
|
|
||
| jobs: | ||
| build: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,7 @@ jobs: | |
| dotnet-version: | | ||
| 8.0.x | ||
| 9.0.x | ||
| 10.0.x | ||
|
|
||
| - name: Get git tag | ||
| id: git_tag | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -92,11 +92,11 @@ jobs: | |
| env: | ||
| CI: false | ||
| run: | | ||
| dotnet build ${{ github.workspace }}/${{ env.TEST_PROJECT_PATH }} /bl --configuration ${{ env.DOTNET_CONFIGURATION }} | ||
| dotnet build ${{ github.workspace }}/${{ env.TEST_PROJECT_PATH }} /bl --configuration ${{ env.DOTNET_CONFIGURATION }} -o ${{ github.workspace }}/artifacts/${{ matrix.name }} | ||
|
|
||
| - name: Run tests | ||
| run: >- | ||
| dotnet test ${{ github.workspace }}/${{ env.TEST_PROJECT_PATH }} | ||
| dotnet run ${{ github.workspace }}/${{ env.TEST_PROJECT_PATH }} | ||
| --configuration ${{ env.DOTNET_CONFIGURATION }} | ||
| --logger "console;verbosity=normal" | ||
| --logger "trx" | ||
|
|
@@ -107,7 +107,15 @@ jobs: | |
| --results-directory testresults | ||
| --collect "XPlat Code Coverage" | ||
| --no-restore | ||
| --no-build -- RunConfiguration.CollectSourceInformation=true | ||
| --no-build | ||
| --filter-not-trait "category=failing" | ||
| --report-trx | ||
| --report-trx-filename "${{ matrix.name }}-${{ matrix.os }}.trx" | ||
| --ignore-exit-code 8 | ||
| -- RunConfiguration.CollectSourceInformation=true | ||
|
||
| --coverage | ||
| --coverage-output-format cobertura | ||
| --coverage-output coverage.cobertura.xml | ||
| env: | ||
| CUSTOM_CONTAINER_REGISTRY: ${{ secrets.CUSTOM_CONTAINER_REGISTRY }} | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -44,11 +44,12 @@ | |||
| <PackageVersion Include="Microsoft.Extensions.DependencyModel" Version="$(DotNetExtensionsVersion)" /> | ||||
| <PackageVersion Include="Microsoft.Extensions.Http" Version="$(DotNetExtensionsVersion)" /> | ||||
| <PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="$(DotNetExtensionsVersion)" /> | ||||
| <PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.7" /> | ||||
| <PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="$(DotNetExtensionsVersion)" /> | ||||
| <!-- .NET packages --> | ||||
| <PackageVersion Include="Microsoft.Extensions.Http.Resilience" Version="9.9.0" /> | ||||
| <PackageVersion Include="Microsoft.Extensions.ServiceDiscovery" Version="$(ServiceDiscoveryVersion)" /> | ||||
| <PackageVersion Include="Microsoft.Extensions.Hosting" Version="$(DotNetExtensionsVersion)" /> | ||||
| <PackageVersion Include="Microsoft.Extensions.Options" Version="$(DotNetExtensionsVersion)" /> | ||||
| <PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" /> | ||||
| <PackageVersion Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="$(DotNetExtensionsVersion)" /> | ||||
| <!-- OpenTelemetry packages --> | ||||
|
|
@@ -99,12 +100,14 @@ | |||
| <PackageVersion Include="coverlet.collector" Version="6.0.4" /> | ||||
| <PackageVersion Include="OpenFeature.Contrib.Providers.Flagd" Version="0.3.3" /> | ||||
| <PackageVersion Include="OpenFeature.Providers.Ofrep" Version="0.1.2" /> | ||||
| <PackageVersion Include="MartinCostello.Logging.XUnit" Version="0.6.0" /> | ||||
| <PackageVersion Include="MartinCostello.Logging.XUnit.v3" Version="0.6.0" /> | ||||
| <PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.14.1" /> | ||||
| <PackageVersion Include="xunit" Version="2.9.3" /> | ||||
| <PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" /> | ||||
| <PackageVersion Include="xunit.extensibility.execution" Version="2.9.3" /> | ||||
| <PackageVersion Include="Microsoft.DotNet.XUnitExtensions" Version="9.0.0-beta.24568.1" /> | ||||
| <PackageVersion Include="xunit.v3" Version="3.2.0" /> | ||||
|
||||
| <PackageVersion Include="xunit.v3.assert" Version="3.2.0" /> | ||||
| <PackageVersion Include="xunit.v3.extensibility.core" Version="3.2.0" /> | ||||
| <PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" /> | ||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: no longer needed if you don't care about VSTest support. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||
| <PackageVersion Include="Microsoft.DotNet.XUnitV3Extensions" Version="11.0.0-beta.25509.1" /> | ||||
| <PackageVersion Include="Microsoft.Testing.Extensions.CodeCoverage" Version="18.1.0" /> | ||||
| <PackageVersion Include="GitHubActionsTestLogger" Version="2.4.1" /> | ||||
| <PackageVersion Include="Moq" Version="$(MoqVersion)" /> | ||||
| <!-- Build dependencies --> | ||||
|
|
@@ -113,8 +116,9 @@ | |||
| <PackageVersion Include="Testcontainers" Version="$(TestContainersVersion)" /> | ||||
| <PackageVersion Include="Testcontainers.MsSql" Version="$(TestContainersVersion)" /> | ||||
| </ItemGroup> | ||||
| <ItemGroup Label=".NET 9 Overrides" Condition="'$(TargetFramework)' == 'net9.0'"> | ||||
| <PackageVersion Update="Microsoft.Extensions.Logging.Abstractions" Version="9.0.10" /> | ||||
| <PackageVersion Include="Microsoft.Extensions.Options" Version="9.0.10" /> | ||||
|
|
||||
| <ItemGroup Label="System"> | ||||
| <PackageVersion Include="System.Linq.Async" Version="6.0.1" /> | ||||
| <PackageVersion Include="System.Linq.AsyncEnumerable" Version="$(DotNetExtensionsVersion)" /> | ||||
| </ItemGroup> | ||||
| </Project> | ||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| #!/usr/bin/env bash | ||
| # Recursively delete all `bin` and `obj` folders from the repository. | ||
| # Usage: ./eng/clean-bin-obj.sh | ||
| # Optional flags: | ||
| # --dry-run Show what would be removed without deleting. | ||
| # --quiet Suppress per-folder output; only show summary. | ||
| # --help Display help. | ||
| # | ||
| # The script resolves the repo root based on its own location so it can be | ||
| # invoked from any working directory. | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| print_help() { | ||
| cat <<'EOF' | ||
| Clean bin/obj folders | ||
|
|
||
| Deletes ALL directories named `bin` or `obj` under the repository root. | ||
|
|
||
| Flags: | ||
| --dry-run List directories that would be deleted. | ||
| --quiet Only print summary information. | ||
| --help Show this help text. | ||
|
|
||
| Examples: | ||
| ./eng/clean-bin-obj.sh | ||
| ./eng/clean-bin-obj.sh --dry-run | ||
| ./eng/clean-bin-obj.sh --quiet | ||
| EOF | ||
| } | ||
|
|
||
| DRY_RUN=0 | ||
| QUIET=0 | ||
| for arg in "$@"; do | ||
| case "$arg" in | ||
| --dry-run) DRY_RUN=1 ;; | ||
| --quiet) QUIET=1 ;; | ||
| --help|-h) print_help; exit 0 ;; | ||
| *) echo "Unknown argument: $arg" >&2; exit 1 ;; | ||
| esac | ||
| done | ||
|
|
||
| # Determine repo root (parent of this script's directory) | ||
| SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) | ||
| REPO_ROOT=$(cd "${SCRIPT_DIR}/.." && pwd) | ||
|
|
||
| cd "$REPO_ROOT" | ||
|
|
||
| # Collect bin/obj directories excluding anything under .git to be safe. | ||
| # Use -prune to avoid descending into matched directories after they are found. | ||
| mapfile -t TARGETS < <(find . -type d \( -name bin -o -name obj \) -not -path '*/.git/*' -prune -print) | ||
|
|
||
| COUNT=${#TARGETS[@]} | ||
| if [[ $COUNT -eq 0 ]]; then | ||
| [[ $QUIET -eq 0 ]] && echo "No bin/obj directories found under $REPO_ROOT." || true | ||
| exit 0 | ||
| fi | ||
|
|
||
| if [[ $DRY_RUN -eq 1 ]]; then | ||
| [[ $QUIET -eq 0 ]] && printf '%s\n' "Dry run: the following $COUNT directories would be deleted:" || true | ||
| printf '%s\n' "${TARGETS[@]}" | ||
| exit 0 | ||
| fi | ||
|
|
||
| # Delete directories. | ||
| DELETED=0 | ||
| for dir in "${TARGETS[@]}"; do | ||
| if [[ $QUIET -eq 0 ]]; then | ||
| echo "Removing: $dir" | ||
| fi | ||
| rm -rf "$dir" || { | ||
| echo "Failed to remove: $dir" >&2 | ||
| continue | ||
| } | ||
| # Increment without triggering set -e early exit (arithmetic exit status is 1 when result is 0 for post-increment) | ||
| ((DELETED++)) || true | ||
| done | ||
|
|
||
| if [[ $QUIET -eq 0 ]]; then | ||
| echo "Removed $DELETED bin/obj directories under $REPO_ROOT." | ||
| else | ||
| echo "Removed $DELETED directories." # Always show a minimal summary in quiet mode. | ||
| fi | ||
|
|
||
| exit 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to:
--logger "console;verbosity=normal".--logger trxwith--report-trx(and ensure Microsoft.Testing.Extensions.TrxReport is referenced)--crashdump,--hangdump, and--hangdump-timeout 7m--results-directoryis changing the meaning a little bit with this PR. Previously it would be relative to current working directory${{ github.workspace }}while with this PR it will be relative to the test executable. So either pass the full path, or keep usingdotnet testwhich will handle the path transformation for you.--collect "XPlat Code Coverage"needs to be replaced with--coverage(and ensure Microsoft.Testing.Extensions.CodeCoverage is referenced)