Skip to content

Commit 5d8554e

Browse files
authored
Fix CI badge and test failure when tests are skipped (#1071)
1 parent 11d5e50 commit 5d8554e

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[![appveyor-build-status][]][appveyor-build-site]
22

3-
[appveyor-build-status]: https://ci.appveyor.com/api/projects/status/github/PowerShell/PSReadLine?branch=master&svg=true
3+
[appveyor-build-status]: https://ci.appveyor.com/api/projects/status/9mygtkr9fkov47xv/branch/master?svg=true
44
[appveyor-build-site]: https://ci.appveyor.com/project/PowerShell/PSReadLine?branch=master
55

66
<!--

tools/helper.psm1

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ function Start-TestRun
227227
$env:PSREADLINE_TESTRUN = 1
228228
Push-Location "$RepoRoot/test"
229229

230+
$xUnitTestExecuted = $true
230231
if ($IsWindowsEnv)
231232
{
232233
if ($env:APPVEYOR -or $env:TF_BUILD)
@@ -246,6 +247,8 @@ function Start-TestRun
246247

247248
try
248249
{
250+
$xUnitTestExecuted = $false
251+
249252
# Remember the current keyboard layout, changes are system wide and restoring
250253
# is the nice thing to do.
251254
$savedLayout = [KeyboardLayoutHelper]::GetCurrentKeyboardLayout()
@@ -266,6 +269,11 @@ function Start-TestRun
266269
# We have to use Start-Process so it creates a new window, because the keyboard
267270
# layout change won't be picked up by any processes running in the current conhost.
268271
RunXunitTestsInNewProcess -Layout $layout -OperatingSystem 'Windows'
272+
$xUnitTestExecuted = $true
273+
}
274+
else
275+
{
276+
Write-Log "Testing not supported for the keyboard layout '$layout'."
269277
}
270278
}
271279
}
@@ -281,8 +289,11 @@ function Start-TestRun
281289
RunXunitTestsInNewProcess -Layout 'en-US' -OperatingSystem 'Linux'
282290
}
283291

284-
# Check to see if there were any failures in xUnit tests, and throw exception to fail the build if so.
285-
Get-ChildItem $testResultFolder | Test-XUnitTestResults > $null
292+
if ($xUnitTestExecuted)
293+
{
294+
# Check to see if there were any failures in xUnit tests, and throw exception to fail the build if so.
295+
Get-ChildItem $testResultFolder | Test-XUnitTestResults > $null
296+
}
286297
}
287298
finally
288299
{

0 commit comments

Comments
 (0)