Skip to content

Instantly share code, notes, and snippets.

@kilasuit
Created April 14, 2021 10:16
Show Gist options
  • Save kilasuit/16e33d9e893c2b312bcba10d48a64c6e to your computer and use it in GitHub Desktop.
Save kilasuit/16e33d9e893c2b312bcba10d48a64c6e to your computer and use it in GitHub Desktop.
Pester Test for script error checking
It "Is valid Powershell (Has no script errors)" {
$contents = Get-Content -Path $module.FullName -ErrorAction Stop
$errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
$errors.Count | Should Be 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment