Skip to content

Commit 149a563

Browse files
authored
Update run-tests.ps1 (#484)
1 parent e37cb9b commit 149a563

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/run-tests.ps1

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,20 @@ Get-ChildItem -Recurse -Filter "*Tests.csproj" -Path . | ForEach-Object {
1919

2020
foreach ($fw in $frameworks) {
2121
Write-Host "Running $projName [$fw]" -ForegroundColor Cyan
22-
dotnet run --project $proj --configuration Release --framework $fw --no-build
23-
if ($LASTEXITCODE -ne 0) { throw "Tests failed for $projName [$fw]" }
22+
$trxName = "$($projName -replace '\.csproj$','')_${fw}.trx"
23+
$trxDir = Join-Path $PSScriptRoot "TestResults"
24+
dotnet run --project $proj --configuration Release --framework $fw --no-build -- --report-trx --report-trx-filename $trxName --results-directory $trxDir
25+
$testExitCode = $LASTEXITCODE
26+
27+
if ($env:APPVEYOR_JOB_ID) {
28+
$trxFile = Join-Path $trxDir $trxName
29+
if (Test-Path $trxFile) {
30+
Write-Host "Uploading $trxName to AppVeyor" -ForegroundColor Green
31+
$wc = New-Object 'System.Net.WebClient'
32+
$wc.UploadFile("https://ci.appveyor.com/api/testresults/mstest/$($env:APPVEYOR_JOB_ID)", $trxFile)
33+
}
34+
}
35+
36+
if ($testExitCode -ne 0) { throw "Tests failed for $projName [$fw]" }
2437
}
2538
}

0 commit comments

Comments
 (0)