Skip to content

Commit 08eda8b

Browse files
bergmeisterTravisEz13
authored andcommitted
Use dotnet test since the dotnet xunit test runner has been deprecated (PowerShell#7980)
1 parent d8b755c commit 08eda8b

File tree

3 files changed

+10
-14
lines changed

3 files changed

+10
-14
lines changed

build.psm1

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,13 +1369,6 @@ function Start-PSxUnit {
13691369
throw "PowerShell must be built before running tests!"
13701370
}
13711371

1372-
if (Test-Path $SequentialTestResultsFile) {
1373-
Remove-Item $SequentialTestResultsFile -Force -ErrorAction SilentlyContinue
1374-
}
1375-
if (Test-Path $ParallelTestResultsFile) {
1376-
Remove-Item $ParallelTestResultsFile -Force -ErrorAction SilentlyContinue
1377-
}
1378-
13791372
try {
13801373
Push-Location $PSScriptRoot/test/csharp
13811374

@@ -1413,8 +1406,10 @@ function Start-PSxUnit {
14131406
}
14141407

14151408
# Run sequential tests first, and then run the tests that can execute in parallel
1416-
dotnet xunit -configuration $Options.configuration -xml $SequentialTestResultsFile -namespace "PSTests.Sequential" -parallel none
1417-
1409+
if (Test-Path $SequentialTestResultsFile) {
1410+
Remove-Item $SequentialTestResultsFile -Force -ErrorAction SilentlyContinue
1411+
}
1412+
dotnet test --configuration $Options.configuration --filter FullyQualifiedName~PSTests.Sequential -p:ParallelizeTestCollections=false --test-adapter-path:. "--logger:xunit;LogFilePath=$SequentialTestResultsFile"
14181413
Publish-TestResults -Path $SequentialTestResultsFile -Type 'XUnit' -Title 'Xunit Sequential'
14191414

14201415
$extraParams = @()
@@ -1430,7 +1425,10 @@ function Start-PSxUnit {
14301425
)
14311426
}
14321427

1433-
dotnet xunit -configuration $Options.configuration -xml $ParallelTestResultsFile -namespace "PSTests.Parallel" -nobuild @extraParams
1428+
if (Test-Path $ParallelTestResultsFile) {
1429+
Remove-Item $ParallelTestResultsFile -Force -ErrorAction SilentlyContinue
1430+
}
1431+
dotnet test --configuration $Options.configuration --filter FullyQualifiedName~PSTests.Parallel --no-build --test-adapter-path:. "--logger:xunit;LogFilePath=$ParallelTestResultsFile"
14341432
Publish-TestResults -Path $ParallelTestResultsFile -Type 'XUnit' -Title 'Xunit Parallel'
14351433
}
14361434
finally {

test/csharp/csharp.tests.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424
<PackageReference Include="xunit" Version="2.4.0" />
2525
<PackageReference Include="Xunit.SkippableFact" Version="1.3.12" />
2626
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
27-
<!-- DotNetCliToolReference element specifies the CLI tool that the user wants to restore in the context of the project. -->
28-
<DotNetCliToolReference Include="dotnet-xunit" Version="2.4.0-beta.1.build3958" />
27+
<PackageReference Include="XunitXml.TestLogger" Version="2.0.0" />
2928
</ItemGroup>
3029

3130
</Project>

test/hosting/hosting.tests.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616

1717
<ItemGroup>
1818
<PackageReference Include="xunit" Version="2.4.0" />
19-
<!-- DotNetCliToolReference element specifies the CLI tool that the user wants to restore in the context of the project. -->
20-
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
19+
<PackageReference Include="XunitXml.TestLogger" Version="2.0.0" />
2120
<!-- The version of Microsoft.PowerShell.SDK should be the version we are releasing, so the tests use the correct SDK before publishing to NuGet.org -->
2221
<PackageReference Include="Microsoft.PowerShell.SDK" Version="6.1.0" />
2322
<PackageReference Include="Xunit.SkippableFact" Version="1.3.6" />

0 commit comments

Comments
 (0)