Skip to content

Instantly share code, notes, and snippets.

@nohwnd
Created January 7, 2019 18:02
Show Gist options
  • Save nohwnd/ba4f9d7a12b9ca1f0cef568fd7a50044 to your computer and use it in GitHub Desktop.
Save nohwnd/ba4f9d7a12b9ca1f0cef568fd7a50044 to your computer and use it in GitHub Desktop.
Adding a filter to It via wrapper
function ItWithTag (
$Name,
$Body,
$Tag
) {
if ($null -eq $global:Tags -or 0 -eq $global:Tags.Length -or $global:Tags -contains $Tag) {
It $Name $Body
}
}
$global:tags = @("t")
Describe "a" {
Write-Host d1
ItWithTag "does not run" {
Write-Host t1
}
ItWithTag "runs" -Tag "t" {
Write-Host t2
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment