Skip to content

Commit 8103034

Browse files
committed
Update run-tests.ps1
1 parent 421dd5c commit 8103034

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

src/run-tests.ps1

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
Get-ChildItem -Recurse -Filter "*Tests.csproj" -Path . | ForEach-Object {
2-
$proj = $_.FullName
3-
$projName = $_.Name
1+
function Run-TestProject($proj) {
2+
$projName = (Get-Item $proj).Name
43
[xml]$xml = Get-Content $proj
54

65
# Collect all framework values from TargetFrameworks and TargetFramework elements
@@ -23,3 +22,22 @@ Get-ChildItem -Recurse -Filter "*Tests.csproj" -Path . | ForEach-Object {
2322
if ($LASTEXITCODE -ne 0) { throw "Tests failed for $projName [$fw]" }
2423
}
2524
}
25+
26+
# Run ApiBuilderTests first
27+
$apiBuilderTests = Get-ChildItem -Recurse -Filter "ApiBuilderTests.csproj" -Path .
28+
if ($apiBuilderTests) {
29+
Run-TestProject $apiBuilderTests.FullName
30+
31+
# Check for git diffs after ApiBuilderTests
32+
$gitDiff = git diff --stat HEAD
33+
if ($gitDiff) {
34+
Write-Host "Git diffs detected after ApiBuilderTests:" -ForegroundColor Red
35+
Write-Host $gitDiff
36+
throw "Build failed: Uncommitted changes detected after running ApiBuilderTests"
37+
}
38+
}
39+
40+
# Run remaining test projects
41+
Get-ChildItem -Recurse -Filter "*Tests.csproj" -Path . | Where-Object { $_.Name -ne "ApiBuilderTests.csproj" } | ForEach-Object {
42+
Run-TestProject $_.FullName
43+
}

0 commit comments

Comments
 (0)