-
The basic idea is that I have some tests that should basically look the same whether I'm implementing them as unit tests or integration tests. I'd like to not duplicate them, and instead use tags like Is there a way to do this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Checking configuration at runtime will depend on #318. $____Pester.Configuration.Filter.Tag.Value
$____Pester.Configuration.Filter.ExcludeTag.Value Supported workaround: $containers = New-PesterContainer -Path '/workspaces/Pester/Samples/' -Data @{ RunAsUnitTests = $true }
# Set in Run.Container if using Advanced Configuration
Invoke-Pester -Container $containers -Output Detailed
If your testsfiles define it as a parameter as well, ex. & ./myTestFile.tests.ps1 # $RunAsUnitTests would be false. Typically F5 in VSCode
& ./myTestFile.tests.ps1 -RunAsUnitTests # $RunAsUnitTests would be true |
Beta Was this translation helpful? Give feedback.
Checking configuration at runtime will depend on #318.
If you don't mind relying on internal API that will likely change (ex. the variable name when made public), then you can use:
Supported workaround:
You can use container/script Data to set a variable, ex.
$RunAsUnitTests
would then be available in both Discovery and Run-phase.If your testsfiles define it as a parameter as well, ex.
p…