-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Get-Help should find help files under $pshome #3528
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
Conversation
|
||
try | ||
{ | ||
New-Item -ItemType File -Path "$PSHOME\en-US\$helpFile" -Value "about_test" -ErrorAction SilentlyContinue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we use SilentlyContinue
we do not need to use Test-Path
.
We can move New-Item's in BeforeAll
:
BeforeAll {
$helpFile = "about_testCase.help.txt"
New-Item -ItemType Directory -Path "$PSHOME\en-US" -ErrorAction SilentlyContinue
New-Item -ItemType File -Path "$PSHOME\en-US\$helpFile" -Value "about_test" -ErrorAction SilentlyContinue
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Closed.
} | ||
finally | ||
{ | ||
Remove-Item "$PSHOME\en-US\$helpFile" -Force -ErrorAction SilentlyContinue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move it to AfterAll
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Closed.
Remove-Item "$PSHOME\en-US\$helpFile" -Force -ErrorAction SilentlyContinue | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You missed "}".
@@ -199,5 +219,6 @@ Describe "Validate about_help.txt under culture specific folder works" -Tags @(' | |||
$help = Get-Help about_testhelp | |||
$help.count | Should Be 1 | |||
$help | Should BeExactly "Hello" | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the extra line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Closed.
{ | ||
New-Item -ItemType File -Path "$PSHOME\en-US\$helpFile" -Value "about_test" -ErrorAction SilentlyContinue | ||
$helpContent = Get-Help about_testCase | ||
$helpContent | Should Not Be $null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we verify the exact value instead of $null
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Closed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be:
$helpContent | Should Not BeNullOrEmpty
|
||
Describe "Validate about_help.txt under culture specific folder works" -Tags @('CI') { | ||
BeforeAll { | ||
$modulePath = "$pshome\Modules\Test" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please clarify - is "Module" hardcoded for searching help files? And do this folder always exist? Maybe we should New-Item
for it too?
I restarted MacOS because it appeared to have an issue downloading dotnet cli |
@chunqingchen please verify this also addresses #2649 |
$helpFile = "about_testCase.help.txt" | ||
if (!(Test-Path $PSHOME\en-US)) | ||
{ | ||
New-Item -ItemType Directory -Path "$PSHOME\en-US" -ErrorAction SilentlyContinue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be as follows to avoid output on console.
$null = New-Item -ItemType Directory -Path "$PSHOME\en-US" -ErrorAction SilentlyContinue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved
|
||
try | ||
{ | ||
New-Item -ItemType File -Path "$PSHOME\en-US\$helpFile" -Value "about_test" -ErrorAction SilentlyContinue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved
{ | ||
New-Item -ItemType File -Path "$PSHOME\en-US\$helpFile" -Value "about_test" -ErrorAction SilentlyContinue | ||
$helpContent = Get-Help about_testCase | ||
$helpContent | Should Not Be $null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be:
$helpContent | Should Not BeNullOrEmpty
@adityapatwardhan your comments are resolved |
Describe "Get-Help should find help info within help files" -Tags @('CI', 'RequireAdminOnWindows') { | ||
It "Get-Help should find help files under pshome" { | ||
$helpFile = "about_testCase.help.txt" | ||
if (!(Test-Path $PSHOME\en-US)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this test case only meant to run on en-US? If it is, then you should skip it for non-English runs. Otherwise, please use (get-uiculture).Name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved
{ | ||
$null = New-Item -ItemType File -Path "$PSHOME\en-US\$helpFile" -Value "about_test" -ErrorAction SilentlyContinue | ||
$helpContent = Get-Help about_testCase | ||
$helpContent | Should Not Be $null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check should probably be $helpContent | Should Match "about_test"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved
@Francisco-Gamino thanks, your comments are resolved |
It "Get-Help should find help files under pshome" { | ||
$helpFile = "about_testCase.help.txt" | ||
$culture = (Get-Culture).Name | ||
if (!(Test-Path $PSHOME\en-US)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, does this tests run on Linux? If it does, then please use Join-Path instead of "$path\value"
E.g.,
$helpContentPath = join-path $PSHOME $culture
if (-not (test-path $helpContentPath))
{
}
@Francisco-Gamino thanks, your comment is resolved ! |
@Francisco-Gamino && @adityapatwardhan Do you guys have any more concerns or is this ready for merge? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update this path $modulePath\en-US to $modulePath(get-uiculture).name. Other than that, it looks good. Thanks.
Describe "Validate about_help.txt under culture specific folder works" -Tags @('CI') { | ||
BeforeAll { | ||
$modulePath = "$pshome\Modules\Test" | ||
$null = New-Item -Path $modulePath\en-US -ItemType Directory -Force |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This path should be $modulePath(get-culture).name
@chunqingchen Changes approved. |
@Francisco-Gamino en-us is replaced with culture |
Relevant issue: #2653 #2649
Steps to reproduce
get-help should be able to find the latest help files under $pshome
Actual behavior
get-help only get the files from C:\Windows\System32\WindowsPowerShell\v1.0
Environment data