Skip to content

Commit

Permalink
Fix some bugs with the new XunitAssert (#13510)
Browse files Browse the repository at this point in the history
I found a few bugs in trying to enable dotnet/runtime#86193.
One is that there's no way to flip Arcade to pull in the fork package instead of xunit.assert.
The second is that when both are pulled in, because the fork has a different assembly name, the
references are ambiguous and produce compile-time breaks. Matching names seems like it will get
rid of that problem, and it also has the side-effect of letting the analyzer work properly against
the fork.
  • Loading branch information
agocke authored May 18, 2023
1 parent abdbcbd commit a130eb4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
5 changes: 4 additions & 1 deletion src/Microsoft.DotNet.Arcade.Sdk/tools/XUnit/XUnit.targets
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="xunit" Version="$(XUnitVersion)" IsImplicitlyDefined="true" PrivateAssets="all" Publish="true"/>
<PackageReference Include="xunit.core" Version="$(XUnitVersion)" IsImplicitlyDefined="true" PrivateAssets="all" Publish="true" />
<PackageReference Include="xunit.analyzers" Version="$(XUnitVersion)" IsImplicitlyDefined="true" PrivateAssets="all" Publish="true" />
<PackageReference Include="xunit.assert" Version="$(XUnitVersion)" IsImplicitlyDefined="true" PrivateAssets="all" Publish="true" Condition="'$(UseDotNetXUnitAssert)' != 'true'" />
<PackageReference Include="Microsoft.DotNet.XUnitAssert" Version="$(MicrosoftDotNetXUnitAssertVersion)" IsImplicitlyDefined="true" PrivateAssets="all" Publish="true" Condition="'$(UseDotNetXUnitAssert)' == 'true'" />
<PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitRunnerVisualStudioVersion)" IsImplicitlyDefined="true" PrivateAssets="all" Publish="true"/>
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<TargetFrameworks>$(NetCurrent);$(NetMinimum)</TargetFrameworks>
<AssemblyName>xunit.assert</AssemblyName>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>true</IsPackable>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<PropertyGroup>
<TargetFramework>$(NetCurrent)</TargetFramework>
<Nullable>enable</Nullable>
<!-- Baseline analyzer warnings. These warnings are present in the upstream xunit.assert tests. -->
<NoWarn>$(NoWarn);xUnit2000;xUnit2003;xUnit2005;xUnit2007;xUnit2011;xUnit2015;xUnit2017</NoWarn>
<UseDotNetXUnitAssert>true</UseDotNetXUnitAssert>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit a130eb4

Please sign in to comment.