Skip to content

Commit 7bb1cd9

Browse files
SyncFileContentsSyncFileContents
authored andcommitted
Sync scripts\PSBuild.psm1
1 parent e998279 commit 7bb1cd9

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

scripts/PSBuild.psm1

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1465,6 +1465,21 @@ function Invoke-DotNetTest {
14651465

14661466
Write-StepHeader "Running Tests with Coverage" -Tags "Invoke-DotNetTest"
14671467

1468+
# Check if there are any test projects in the solution
1469+
$testProjects = @(Get-ChildItem -Recurse -Filter "*.csproj" | Where-Object {
1470+
$_.Name -match "\.Test\.csproj$" -or
1471+
$_.Directory.Name -match "\.Test$" -or
1472+
$_.Directory.Name -eq "Test" -or
1473+
(Select-String -Path $_.FullName -Pattern "<IsTestProject>true</IsTestProject>" -Quiet)
1474+
})
1475+
1476+
if ($testProjects.Count -eq 0) {
1477+
Write-Information "No test projects found in solution. Skipping test execution." -Tags "Invoke-DotNetTest"
1478+
return
1479+
}
1480+
1481+
Write-Information "Found $($testProjects.Count) test project(s)" -Tags "Invoke-DotNetTest"
1482+
14681483
# Ensure the TestResults directory exists
14691484
$testResultsPath = Join-Path $CoverageOutputPath "TestResults"
14701485
New-Item -Path $testResultsPath -ItemType Directory -Force | Out-Null

0 commit comments

Comments
 (0)