Most tests run without cloning the labview-icon-editor repository. The helper defaults to the repository root as the project directory.
Tests that need the example project can either clone it under open-source/labview-icon-editor:
git clone https://github.com/LabVIEW-Community-CI-CD/labview-icon-editor.git labview-icon-editoror set LABVIEW_ICON_EDITOR_PATH to the location of an existing clone:
export LABVIEW_ICON_EDITOR_PATH=/path/to/labview-icon-editorTo enforce that the project exists, set LABVIEW_ICON_EDITOR_REQUIRED=1 or call Get-LabVIEWIconEditorArgsJson -RequireProject in your test.
Tooling for local runs:
- PowerShell 7.5.1
- Node.js 24 or newer
actionlint- Optional: Pester (install with
Install-Module Pester -Force -Scope CurrentUserfor local runs; CI installs it automatically)
Sample command sequence to run the suite locally:
npm install
actionlint
Install-Module Pester -Force -Scope CurrentUser # only if Pester isn't already installed
$cfg = New-PesterConfiguration
$cfg.Run.Path = './tests/pester'
$cfg.TestResult.Enabled = $false
Invoke-Pester -Configuration $cfgPester tests share a small helper module, tests/pester/Helper/ArgsJson.psm1, which exposes Get-LabVIEWIconEditorArgsJson. The function returns a canonical set of dispatcher arguments and the project root so every test starts from the same baseline. Using the helper avoids repeating boilerplate and keeps tests resilient to environment differences.
When available, the helper points at the labview-icon-editor project. This open-source repository is tiny, exercises common LabVIEW project layouts and does not require NI components to execute in dry-run mode. Using it as the reference project gives all tests a consistent, real-world example without adding heavy dependencies.
-
Create a
*.Tests.ps1file undertests/pesteror one of its subfolders. -
Import the helper module:
Import-Module (Join-Path $PSScriptRoot 'Helper' 'ArgsJson.psm1')
-
Use
Get-LabVIEWIconEditorArgsJsonto obtain the canonical JSON and working directory for dispatcher calls. -
Include both positive and negative path tests where practical.
-
Run the suite before submitting a pull request with:
$cfg = New-PesterConfiguration $cfg.Run.Path = './tests/pester' $cfg.TestResult.Enabled = $false Invoke-Pester -Configuration $cfg
XML test result output is intentionally disabled.
It 'describes a known action' {
$params = Get-LabVIEWIconEditorArgsJson
$json = $params.ArgsJson
$wd = $params.WorkingDirectory
$out = pwsh -NoProfile -File $global:dispatcher -Describe build-lvlibp -ArgsJson $json -WorkingDirectory $wd | Out-String
$out | Should -Match 'Major'
}It 'fails on unknown action' {
$params = Get-LabVIEWIconEditorArgsJson
$json = $params.ArgsJson
$wd = $params.WorkingDirectory
pwsh -NoProfile -File $global:dispatcher -ActionName no-such-action -ArgsJson $json -WorkingDirectory $wd *>$null
$LASTEXITCODE | Should -Be 1
}