I have several Describe/It tests in a ps1 file called Behavior.Tests.ps1. Each test, however, can only run successfully on systems with specific hardware. I am aware that I can use tags like this in the Invoke-Pester command:
Invoke-Pester $path -Tag "Acceptance" -ExcludeTag "Flaky", "Slow", "LinuxOnly"
But I cannot count on the user to know the specifics of their hardware and choose the correct -Tag and -ExcludeTag to include. What I would rather do for my workflow is simply have Invoke-Pester .\Behavior.Tests.ps1, and then in the script have code like this that would get hardware info and build the right list of Tags and ExcludeTags:
if ($currentHardware -in $HardwareList) {
$ExcludeTag += $TagFlaky
}
Then I would have a list of Tags and ExcludeTags before the first Describe/It that would run the right tests in the entire ps1 file. Is this possible in v5 Pester? I tried to debug and find the argument -Tag to modify it, but I could not find it.