diff --git a/build.psm1 b/build.psm1 index 101fb8b007..de00900347 100644 --- a/build.psm1 +++ b/build.psm1 @@ -467,11 +467,24 @@ function Get-PSOutput { function Start-PSPester { [CmdletBinding()]param( - [string]$Flags = "-ExcludeTag 'Slow' -Tag 'CI' -EnableExit -OutputFile pester-tests.xml -OutputFormat NUnitXml", + [string]$OutputFormat = "NUnitXml", + [string]$OutputFile = "pester-tests.xml", + [switch]$DisableExit, + [string[]]$ExcludeTag = "Slow", + [string[]]$Tag = "CI", [string]$Path = "$PSScriptRoot/test/powershell" ) + $tagString = "-outputFormat ${OutputFormat} -outputFile ${outputFile} " + if ( ! $DisableExit ) { $tagString += " -EnableExit" } + if ( $ExcludeTag ) { $tagString += " -ExcludeTag @('" + (${ExcludeTag} -join "','") + "')" } + if ( $Tag ) { $tagString += " -Tag @('" + (${Tag} -join "','") + "')" } - & (Get-PSOutput) -noprofile -c "Import-Module '$PSHOME/Modules/Pester'; Invoke-Pester $Flags $Path" + $powershell = get-psoutput + $psdir = [io.path]::GetDirectoryName($powershell) + $moduleDir = [io.path]::Combine($psdir,"Modules","Pester") + + Write-Verbose "Import-Module '$moduleDir'; Invoke-Pester $tagString $Path" + & (Get-PSOutput) -noprofile -c "Import-Module '$moduleDir'; Invoke-Pester $tagString $Path" if ($LASTEXITCODE -ne 0) { throw "$LASTEXITCODE Pester tests failed" } diff --git a/test/powershell/Host/Base-Directory.Tests.ps1 b/test/powershell/Host/Base-Directory.Tests.ps1 index df3b652173..11811fdb35 100644 --- a/test/powershell/Host/Base-Directory.Tests.ps1 +++ b/test/powershell/Host/Base-Directory.Tests.ps1 @@ -1,4 +1,4 @@ -Describe "Configuration file locations" -tags "CI" { +Describe "Configuration file locations" -tags "CI","Slow" { BeforeAll { $powershell = Join-Path -Path $PsHome -ChildPath "powershell" diff --git a/test/powershell/Host/Read-Host.Tests.ps1 b/test/powershell/Host/Read-Host.Tests.ps1 index 55b262f851..ca31ed388d 100644 --- a/test/powershell/Host/Read-Host.Tests.ps1 +++ b/test/powershell/Host/Read-Host.Tests.ps1 @@ -1,4 +1,4 @@ -Describe "Read-Host" -Tags "CI" { +Describe "Read-Host" -Tags "Slow","Feature" { Context "[Console]::ReadKey() implementation on non-Windows" { BeforeAll { $powershell = Join-Path -Path $PsHome -ChildPath "powershell" diff --git a/test/powershell/Language/Classes/Scripting.Classes.Exceptions.Tests.ps1 b/test/powershell/Language/Classes/Scripting.Classes.Exceptions.Tests.ps1 index ca772f553e..d79f74a641 100644 --- a/test/powershell/Language/Classes/Scripting.Classes.Exceptions.Tests.ps1 +++ b/test/powershell/Language/Classes/Scripting.Classes.Exceptions.Tests.ps1 @@ -1,4 +1,4 @@ -Describe 'Exceptions flow for classes' -Tags "DRT" { +Describe 'Exceptions flow for classes' -Tags "CI" { $canaryHashtable = @{} diff --git a/test/powershell/Language/CompletionTestSupport.psm1 b/test/powershell/Language/CompletionTestSupport.psm1 index aeaa12da5a..bbda7ac589 100644 --- a/test/powershell/Language/CompletionTestSupport.psm1 +++ b/test/powershell/Language/CompletionTestSupport.psm1 @@ -98,7 +98,7 @@ function Test-Completions { foreach ($test in $TestCases) { - Describe $test.Description { + Describe $test.Description -Tags "CI" { $hash = $Test.TestInput $results = Get-Completions @hash diff --git a/test/powershell/Modules/PackageManagement/Get-Package.Tests.ps1 b/test/powershell/Modules/PackageManagement/Get-Package.Tests.ps1 index 650330b044..371338a593 100644 --- a/test/powershell/Modules/PackageManagement/Get-Package.Tests.ps1 +++ b/test/powershell/Modules/PackageManagement/Get-Package.Tests.ps1 @@ -18,7 +18,7 @@ $source = "http://www.nuget.org/api/v2/" # Actual Tests: -Describe "Get-package" -Tags @('BVT', 'DRT'){ +Describe "Get-package" -Tags "Feature" { # make sure that packagemanagement is loaded It "EXPECTED: Get-package accepts array of strings for -providername parameter" -Skip { $x = (get-package -providername Programs,Msi) diff --git a/test/powershell/Modules/PackageManagement/Get-PackageProvider.Tests.ps1 b/test/powershell/Modules/PackageManagement/Get-PackageProvider.Tests.ps1 index 7a1f79558b..275d04dc73 100644 --- a/test/powershell/Modules/PackageManagement/Get-PackageProvider.Tests.ps1 +++ b/test/powershell/Modules/PackageManagement/Get-PackageProvider.Tests.ps1 @@ -72,7 +72,7 @@ Describe "get-packageprovider" -Tags "CI" { } -Describe "Get-PackageProvider with list" Tags "CI" { +Describe "Get-PackageProvider with list" -Tags "CI" { It "lists package providers installed" { $x = (Get-PackageProvider).Count -gt 1 | should be $true diff --git a/test/powershell/enginecore/Parser.Test.ps1 b/test/powershell/enginecore/Parser.Test.ps1 index df22e5f143..24d30f4a56 100644 --- a/test/powershell/enginecore/Parser.Test.ps1 +++ b/test/powershell/enginecore/Parser.Test.ps1 @@ -1,4 +1,4 @@ -Describe "ParserTests (admin\monad\tests\monad\src\engine\core\ParserTests.cs)" { +Describe "ParserTests (admin\monad\tests\monad\src\engine\core\ParserTests.cs)" -Tags "CI" { BeforeAll { $functionDefinitionFile = Join-Path -Path $TestDrive -ChildPath "functionDefinition.ps1" $functionDefinition = @' @@ -825,4 +825,4 @@ Describe "ParserTests (admin\monad\tests\monad\src\engine\core\ParserTests.cs)" $_.FullyQualifiedErrorId | should be "ParseException" } } -} \ No newline at end of file +}