Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use feature flag to generate operator parameter-help in Should #266

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions generate-command-reference.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ $PSDefaultParameterValues['*:ErrorAction'] = "Stop"

Write-Host "Generating MDX files for website Command Reference" -BackgroundColor DarkGreen

# Generate help for Operator switch-parameters for Should.
# CAUTION: Do not use -SkipModuleImport unless this env-var was set prior to importing Pester.
# See https://github.com/pester/Pester/pull/2336
if ($env:PESTER_GENERATE_HELP_FOR_SHOULDOPERATORS -ne 1) {
$env:PESTER_GENERATE_HELP_FOR_SHOULDOPERATORS = 1
$envChanged = $true
}

# -----------------------------------------------------------------------------
# Install required modules
# -----------------------------------------------------------------------------
Expand Down Expand Up @@ -68,6 +76,11 @@ $ModuleList.Keys.Clone() | ForEach-Object {
}
}

if ($envChanged) {
# Revert to default behavior to avoid import perf hit in future imports in same session
$env:PESTER_GENERATE_HELP_FOR_SHOULDOPERATORS = 0
}

# -----------------------------------------------------------------------------
# Use below settings to manipulate the rendered MDX files
# -----------------------------------------------------------------------------
Expand Down