Skip to content
Closed
Show file tree
Hide file tree
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
15 changes: 10 additions & 5 deletions src/Pester.RSpec.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
foreach ($item in $items) {
if ($item.PSIsContainer) {
# this is an existing directory search it for tests file
& $SafeCommands['Get-ChildItem'] -Recurse -Path $item -Filter "*$Extension" -File
# use -Force to include hidden items (e.g. dot-prefixed folders on Linux)
& $SafeCommands['Get-ChildItem'] -Recurse -Path $item -Filter "*$Extension" -File -Force
}
elseif ("FileSystem" -ne $item.PSProvider.Name) {
# item is not a directory and exists but is not a file so we are not interested
Expand Down Expand Up @@ -60,7 +61,8 @@
else {
# this is a path that does not exist so let's hope it is
# a wildcarded path that will resolve to some files
& $SafeCommands['Get-ChildItem'] -Recurse -Path $p -Filter "*$Extension" -File
# use -Force to include hidden items (e.g. dot-prefixed folders on Linux)
& $SafeCommands['Get-ChildItem'] -Recurse -Path $p -Filter "*$Extension" -File -Force
}
}

Expand Down Expand Up @@ -176,6 +178,9 @@ function PostProcess-RspecTestRun ($TestRun) {
$b.Result = if ($b.Skip) {
"Skipped"
}
elseif (0 -lt $b.ErrorRecord.Count) {
"Failed"
}
elseif ($b.Passed) {
"Passed"
}
Expand Down Expand Up @@ -206,12 +211,12 @@ function PostProcess-RspecTestRun ($TestRun) {
$b.result = if ($b.Skip) {
"Skipped"
}
elseif ($b.Passed) {
"Passed"
}
elseif (0 -lt $b.ErrorRecord.Count) {
"Failed"
}
elseif ($b.Passed) {
"Passed"
}
elseif (-not $discoveryOnly -and $b.ShouldRun -and (-not $b.Executed -or -not $b.Passed)) {
"Failed"
}
Expand Down
8 changes: 5 additions & 3 deletions src/functions/TestResults.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -468,10 +468,10 @@ function Get-RunTimeEnvironment {
$computerName = $env:ComputerName
$userName = $env:Username
if ($null -ne $SafeCommands['Get-CimInstance']) {
$osSystemInformation = (& $SafeCommands['Get-CimInstance'] Win32_OperatingSystem)
$osSystemInformation = (& $SafeCommands['Get-CimInstance'] Win32_OperatingSystem -ErrorAction Ignore)
}
elseif ($null -ne $SafeCommands['Get-WmiObject']) {
$osSystemInformation = (& $SafeCommands['Get-WmiObject'] Win32_OperatingSystem)
$osSystemInformation = (& $SafeCommands['Get-WmiObject'] Win32_OperatingSystem -ErrorAction Ignore)
}
elseif ($IsMacOS -or $IsLinux) {
$osSystemInformation = @{
Expand All @@ -492,7 +492,9 @@ function Get-RunTimeEnvironment {
# well, we tried
}
}
else {

# Fall back to unknown values if WMI/CIM returned null (e.g. access denied when not running as Administrator)
if ($null -eq $osSystemInformation) {
$osSystemInformation = @{
Name = 'Unknown'
Version = '0.0.0.0'
Expand Down
Loading