Tests/Pester/runTests.ps1
param ( [Parameter(ParameterSetName = 'Default', Mandatory = $true)] [Parameter(ParameterSetName = 'Publish', Mandatory = $true)] [string] $ModulePath, [Parameter(ParameterSetName = 'Publish')] [switch] $Publish, [Parameter(ParameterSetName = 'Publish', Mandatory = $true)] [string] $PublishPath, [Parameter(ParameterSetName = 'Default')] [Parameter(ParameterSetName = 'Publish')] [hashtable] $Configuration ) Write-Information 'Running Pester tests' # Module stuff Write-Debug 'Looking for Pester module on worker...' $pesterModule = Get-Module -Name Pester -ListAvailable | Where-Object { $_.Version -like '5.*' } if (!$pesterModule) { Write-Debug 'Did not find module on worker. Trying to install it...' try { Install-Module -Name Pester -Scope CurrentUser -Force -SkipPublisherCheck -MinimumVersion '5.0' $pesterModule = Get-Module -Name Pester -ListAvailable | Where-Object { $_.Version -like '5.*' } } catch { Write-Host '##vso[task.logissue type=error]Failed to install the Pester module.' } } #Pester configuration if ($null -eq $Configuration) { Write-Debug "Pester configuration not in arguments. Using file: '$PSScriptRoot\pesterConfig.ps1'" $Configuration = . "$PSScriptRoot\pesterConfig.ps1" } $pesterConfiguration = New-PesterConfiguration -Hashtable $Configuration #Pester preference $pesterPreference = . "$PSScriptRoot\pesterPreference.ps1" Write-Information "Pester version: $($pesterModule.Version.Major).$($pesterModule.Version.Minor).$($pesterModule.Version.Build)" $pesterModule | Import-Module # Handle publishing if ($Publish) { if (!(Test-Path -Path $PublishPath)) { Write-Debug 'Publish folder does not exist. Creating...' New-Item -Path $PublishPath -ItemType Directory -Force | Out-Null } } # Import Module to test Write-Debug 'Looking for module manifest...' $moduleManifest = Get-ChildItem -Path $ModulePath | Where-Object { $_.Name -like '*.psd1' } Write-Debug "Module manifest found: '$moduleManifest'." Write-Information 'Importing module manifest.' Import-Module $moduleManifest.FullName -Force Write-Information 'Invoke Pester.' Invoke-Pester -Configuration $pesterConfiguration # SIG # Begin signature block # MIIPFwYJKoZIhvcNAQcCoIIPCDCCDwQCAQExDzANBglghkgBZQMEAgEFAD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Kr4SyYoCjKJ250qYHFqw5ZOFrljv2GVZ4xLLruwToPpTTHl # jici9Twme0SR09Ra8NN89Di+FJqZDouxW+rkiw8RnXdCghxcOtTaq4gvjVcwVDGC # AlkwggJVAgEBMIGmMIGRMQswCQYDVQQGEwJHQjEbMBkGA1UECBMSR3JlYXRlciBN # YW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFDT01PRE8gQ0Eg # TGltaXRlZDE3MDUGA1UEAxMuQ09NT0RPIFJTQSBFeHRlbmRlZCBWYWxpZGF0aW9u # IENvZGUgU2lnbmluZyBDQQIQW+N4P9Cbsfg+VbDuGvh0/jANBglghkgBZQMEAgEF # AKCBhDAYBgorBgEEAYI3AgEMMQowCKACgAChAoAAMBkGCSqGSIb3DQEJAzEMBgor # BgEEAYI3AgEEMBwGCisGAQQBgjcCAQsxDjAMBgorBgEEAYI3AgEVMC8GCSqGSIb3 # DQEJBDEiBCBFB9XwlEfacJfoH2Rs7P3dEp7/3F2k2R0bEqBP4KoI9TANBgkqhkiG # 9w0BAQEFAASCAQCv9VN8Y0v1p/wlMmRVlNPAF45KYwCsbduYGY+80q6pk4g1wx7T # N9OyZWHlDmXMECHkNxvvlo1oHc2t25mJBcS1pOSn3X2ze93tRXPP2nplUHN5ge2p # UvcyPM7mf+TJ6SEmo6FmIppZVCpkEQIF9MpoWn0E0ckdzBA+vTajDbYLIHivR9k3 # 0kysIfmcil/HSOS3dY5JI444WnUAlp8TpJCITNWSZEozDRpWihuO+MCETNCoVQXU # zYI8DshSphOHTKtqarEEQs98n+1p5ehwb/Xc73AZDMQf4QvmCphBbCSfHgxMCuwN # 6AlhbK7seBYZoui5jajwtnNY63eJs4HR1H7U # SIG # End signature block |