tests/Run.ps1
param( [object[]]$Script, [string[]]$TestName, [switch]$EnableExit, [string]$OutputXml, [string[]]$Tag, [string[]]$ExcludeTag, [object[]]$CodeCoverage, [switch]$Strict, [string]$OutputFile, [string]$OutputFormat, [switch]$Quiet, [object]$PesterOption ) Try { #Ensure Pester is installed if (Get-Module -ListAvailable -Name Pester) { Import-Module -Name Pester Write-Host "Initializing: Pester is ready!" -ForegroundColor Green } else { Write-Host "Initializing: Pester needs to be installed. Beginning installation..." -ForegroundColor Yellow Install-Module -Name Pester } #Ensure Proper PnP Module is loaded Get-Module SharePointPnPPowerShell* | Remove-Module Import-Module $PSScriptRoot\..\modules\SharePointPnPPowerShellOnline -WarningAction SilentlyContinue Write-Host "Initializing: SharePointPnPPowerShellOnline module is loaded!" -ForegroundColor Green #Connect to Tests site Try { Disconnect-PnPOnline } Catch {} Connect-PnPOnline -Url "https://skylinespark.sharepoint.com/sites/skyline-sppowershell-tests" Write-Host "Initializing: Connected to $((Get-PnPWeb).Url)!" -ForegroundColor Green #Import Module Import-Module $PSScriptRoot\..\skyline-sppowershell -Force #Fire up Pester Invoke-Pester @PSBoundParameters #Disconnect from Tests site Disconnect-PnPOnline } Catch { Write-Host "Initialization Failed! Exception: $($_)" } |