Skip to content

Commit 2044548

Browse files
[0.3.1] Release (#8)
* Added VIM (i.e. `hjkl`) navigation support. * Implemented parameter validation and made parameters mandatory to prevent unexpected command failures. * Updated documentation to reflect changes in parameter requirements for `Show-PesterResult` and `Show-PesterResultTree`. - Fixes #3
1 parent bedb6c2 commit 2044548

File tree

7 files changed

+42
-16
lines changed

7 files changed

+42
-16
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8+
## [0.3.1] 2025-05-30
9+
10+
### Added
11+
12+
- Add VIM (i.e. `hjkl`) navigation support.
13+
14+
### Fixed
15+
16+
- Add parameter validation and mandatory to ensure commands don't fail
17+
unexpectedly.
18+
819
## [0.3.0] 2025-05-29
920

1021
### Added

PesterExplorer/PesterExplorer.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
RootModule = 'PesterExplorer.psm1'
1313

1414
# Version number of this module.
15-
ModuleVersion = '0.3.0'
15+
ModuleVersion = '0.3.1'
1616

1717
# Supported PSEditions
1818
# CompatiblePSEditions = @()

PesterExplorer/Private/Get-ShortcutKeyPanel.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ function Get-ShortcutKeyPanel {
2020
#>
2121
[CmdletBinding()]
2222
$shortcutKeys = @(
23-
"Up, Down - Navigate",
23+
"Up/J, Down/K - Navigate",
2424
"Home, End - Jump to Top/Bottom",
2525
"PageUp, PageDown - Scroll",
26-
"Enter - Explore",
27-
"Tab - Switch Panel",
26+
"Enter - Explore Item",
27+
"Tab, Left/H, Right/L - Switch Panel",
2828
"Esc - Back",
2929
"Ctrl+C - Exit"
3030
)

PesterExplorer/Public/Show-PesterResult.ps1

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ function Show-PesterResult {
2727
Justification='This is actually used in the script block.'
2828
)]
2929
param (
30+
[Parameter(Mandatory = $true)]
3031
[ValidateNotNullOrEmpty()]
3132
[Pester.Run]
3233
$PesterResult,
@@ -89,14 +90,13 @@ function Show-PesterResult {
8990

9091
# Handle input
9192
$lastKeyPressed = Get-LastKeyPressed
92-
# ToDo: Add vim navigation keys
9393
if ($null -ne $lastKeyPressed) {
9494
#region List Navigation
9595
if($selectedPane -eq 'list') {
96-
if ($lastKeyPressed.Key -eq "DownArrow") {
96+
if ($lastKeyPressed.Key -in @("j", "DownArrow")) {
9797
$selectedItem = $list[($list.IndexOf($selectedItem) + 1) % $list.Count]
9898
$scrollPosition = 0
99-
} elseif ($lastKeyPressed.Key -eq "UpArrow") {
99+
} elseif ($lastKeyPressed.Key -in @("k", "UpArrow")) {
100100
$selectedItem = $list[($list.IndexOf($selectedItem) - 1 + $list.Count) % $list.Count]
101101
$scrollPosition = 0
102102
} elseif ($lastKeyPressed.Key -eq "PageDown") {
@@ -115,7 +115,7 @@ function Show-PesterResult {
115115
} elseif ($lastKeyPressed.Key -eq "End") {
116116
$selectedItem = $list[-1]
117117
$scrollPosition = 0
118-
} elseif ($lastKeyPressed.Key -in @("Tab", "RightArrow")) {
118+
} elseif ($lastKeyPressed.Key -in @("Tab", "RightArrow", "l")) {
119119
$selectedPane = 'preview'
120120
} elseif ($lastKeyPressed.Key -eq "Enter") {
121121
<# Recurse into Pester Object #>
@@ -150,8 +150,7 @@ function Show-PesterResult {
150150
}
151151
else {
152152
#region Preview Navigation
153-
# ToDo: Add support for scrolling the right panel
154-
if ($lastKeyPressed.Key -in "Escape", "Tab", "LeftArrow", "RightArrow") {
153+
if ($lastKeyPressed.Key -in "Escape", "Tab", "LeftArrow", "h") {
155154
$selectedPane = 'list'
156155
} elseif ($lastKeyPressed.Key -eq "Down") {
157156
# Scroll down in the preview panel
@@ -172,8 +171,22 @@ function Show-PesterResult {
172171

173172
# Generate new data
174173
$titlePanel = Get-TitlePanel -Item $object
175-
$listPanel = Get-ListPanel -List $list -SelectedItem $selectedItem -SelectedPane $selectedPane
176-
$previewPanel = Get-PreviewPanel -Items $items -SelectedItem $selectedItem -ScrollPosition $scrollPosition -PreviewHeight $previewHeight -PreviewWidth $previewWidth -SelectedPane $selectedPane
174+
$getListPanelSplat = @{
175+
List = $list
176+
SelectedItem = $selectedItem
177+
SelectedPane = $selectedPane
178+
}
179+
$listPanel = Get-ListPanel @getListPanelSplat
180+
181+
$getPreviewPanelSplat = @{
182+
Items = $items
183+
SelectedItem = $selectedItem
184+
ScrollPosition = $scrollPosition
185+
PreviewHeight = $previewHeight
186+
PreviewWidth = $previewWidth
187+
SelectedPane = $selectedPane
188+
}
189+
$previewPanel = Get-PreviewPanel @getPreviewPanelSplat
177190

178191
# Update layout
179192
$layout["header"].Update($titlePanel) | Out-Null

PesterExplorer/Public/Show-PesterResultTree.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ function Show-PesterResultTree {
2020
[CmdletBinding()]
2121
[OutputType([void])]
2222
param (
23+
[Parameter(Mandatory = $true)]
24+
[ValidateNotNullOrEmpty()]
2325
[Pester.Run]
2426
$PesterResult
2527
)

docs/en-US/Show-PesterResult.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Open a TUI to explore the Pester result object.
1313
## SYNTAX
1414

1515
```
16-
Show-PesterResult [[-PesterResult] <Run>] [-NoShortcutPanel] [-ProgressAction <ActionPreference>]
16+
Show-PesterResult [-PesterResult] <Run> [-NoShortcutPanel] [-ProgressAction <ActionPreference>]
1717
[<CommonParameters>]
1818
```
1919

@@ -42,7 +42,7 @@ Type: Run
4242
Parameter Sets: (All)
4343
Aliases:
4444

45-
Required: False
45+
Required: True
4646
Position: 1
4747
Default value: None
4848
Accept pipeline input: False

docs/en-US/Show-PesterResultTree.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Show a Pester result in a tree format using Spectre.Console.
1313
## SYNTAX
1414

1515
```
16-
Show-PesterResultTree [[-PesterResult] <Run>] [-ProgressAction <ActionPreference>] [<CommonParameters>]
16+
Show-PesterResultTree [-PesterResult] <Run> [-ProgressAction <ActionPreference>] [<CommonParameters>]
1717
```
1818

1919
## DESCRIPTION
@@ -43,7 +43,7 @@ Type: Run
4343
Parameter Sets: (All)
4444
Aliases:
4545

46-
Required: False
46+
Required: True
4747
Position: 1
4848
Default value: None
4949
Accept pipeline input: False

0 commit comments

Comments
 (0)