Skip to content

Instantly share code, notes, and snippets.

@nohwnd
Created December 6, 2017 16:02
Show Gist options
  • Save nohwnd/31502ae51d28fc473489037f9d88b11d to your computer and use it in GitHub Desktop.
Save nohwnd/31502ae51d28fc473489037f9d88b11d to your computer and use it in GitHub Desktop.
pester fails to remove function
InModuleScope Pester {
[System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '', Scope = '*', Target = 'SuppressImportModule')]
$SuppressImportModule = $true
. $PSScriptRoot\Shared.ps1
Describe 'Function-Name' {
Context "asdf" {
It "breaks" {
Write-Debug "abc"
}
}
}
}
Mock "Write-Debug" {
MockedDebug $Message
}
function MockedDebug {
[System.Diagnostics.CodeAnalysis.SuppressMessage('PSAvoidUsingWriteHost', '')]
[CmdletBinding()]
param(
$Message
)
if ($ShowDebugText) {
Write-Host " [DEBUG] $Message" -ForegroundColor Yellow
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment