Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -843,9 +843,15 @@ function Start-PSPester {
[switch]$Unelevate,
[switch]$Quiet,
[Parameter(ParameterSetName='PassThru',Mandatory=$true)]
[switch]$PassThru
[switch]$PassThru,
[switch]$IncludeFailingTest
)

if ($IncludeFailingTest.IsPresent)
{
$Path += "$PSScriptRoot/tools/failingTests"
}

# we need to do few checks and if user didn't provide $ExcludeTag explicitly, we should alternate the default
if ($Unelevate)
{
Expand Down Expand Up @@ -1079,14 +1085,17 @@ function Test-PSPesterResults
{
if ($ResultObject.TotalCount -le 0)
{
logerror 'NO TESTS RUN'
throw 'NO TESTS RUN'
}
elseif ($ResultObject.FailedCount -gt 0)
{
logerror 'TEST FAILURES'

$ResultObject.TestResult | Where-Object {$_.Passed -eq $false} | ForEach-Object {
Show-PSPesterError -testFailureObject $_
}

throw "$($ResultObject.FailedCount) tests in $TestArea failed"
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions tools/failingTests/fail.tests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Describe "Failing test used to test CI Scripts" -Tags 'CI' {
It "Should fail" {
1 | should be 2
}
}
6 changes: 6 additions & 0 deletions tools/travis.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ else

# Run a full build if the build was trigger via cron, api or the commit message contains `[Feature]`
$hasFeatureTag = $commitMessage -match '\[feature\]'
$hasRunFailingTestTag = $commitMessage -match '\[includeFailingTest\]'
$isDailyBuild = $env:TRAVIS_EVENT_TYPE -eq 'cron' -or $env:TRAVIS_EVENT_TYPE -eq 'api'
# only update the build badge for the cron job
$cronBuild = $env:TRAVIS_EVENT_TYPE -eq 'cron'
Expand Down Expand Up @@ -167,6 +168,11 @@ else
$pesterParam['ThrowOnFailure'] = $true
}

if ($hasRunFailingTestTag)
{
$pesterParam['IncludeFailingTest'] = $true
}

# Remove telemetry semaphore file in CI
$telemetrySemaphoreFilepath = Join-Path $output DELETE_ME_TO_DISABLE_CONSOLEHOST_TELEMETRY
if ( Test-Path "${telemetrySemaphoreFilepath}" ) {
Expand Down