Skip to content

Commit 254a83d

Browse files
fix: correct Join-Path usage for schema path in Validate-Settings.ps1 and update IncrementalPrerelease default value
1 parent 7103479 commit 254a83d

2 files changed

Lines changed: 36 additions & 5 deletions

File tree

scripts/main.ps1

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ $settings = [pscustomobject]@{
161161
Skip = $settings.Publish.Module.Skip ?? $false
162162
AutoCleanup = $settings.Publish.Module.AutoCleanup ?? $true
163163
AutoPatching = $settings.Publish.Module.AutoPatching ?? $true
164-
IncrementalPrerelease = $settings.Publish.Module.IncrementalPrerelease ?? $trueø
164+
IncrementalPrerelease = $settings.Publish.Module.IncrementalPrerelease ?? $true
165165
DatePrereleaseFormat = $settings.Publish.Module.DatePrereleaseFormat ?? ''
166166
VersionPrefix = $settings.Publish.Module.VersionPrefix ?? 'v'
167167
MajorLabels = $settings.Publish.Module.MajorLabels ?? 'major, breaking'
@@ -263,6 +263,22 @@ if ($settings.Test.Skip) {
263263
Write-Host "Tests found at [$testsPath]"
264264

265265
function Get-TestItemsFromFolder {
266+
<#
267+
.SYNOPSIS
268+
Retrieves test items from a specified folder.
269+
270+
.DESCRIPTION
271+
This function searches for test-related files in the specified folder.
272+
It looks for configuration files (*.Configuration.ps1), container files (*.Container.ps1),
273+
and test files (*.Tests.ps1) in that order of precedence.
274+
275+
.PARAMETER FolderPath
276+
The path to the folder to search for test items.
277+
278+
.OUTPUTS
279+
System.IO.FileInfo[]
280+
Returns an array of test-related files found in the folder.
281+
#>
266282
param ([string]$FolderPath)
267283

268284
$configFiles = Get-ChildItem -Path $FolderPath -File -Filter '*.Configuration.ps1'
@@ -281,21 +297,36 @@ if ($settings.Test.Skip) {
281297
return $testFiles
282298
}
283299

284-
function Find-TestDirectories {
300+
function Find-TestDirectory {
301+
<#
302+
.SYNOPSIS
303+
Finds test directories recursively.
304+
305+
.DESCRIPTION
306+
This function recursively searches for all directories starting from the specified path.
307+
It returns a flat array of all directory paths found.
308+
309+
.PARAMETER Path
310+
The root path to start searching for directories.
311+
312+
.OUTPUTS
313+
System.String[]
314+
Returns an array of directory paths.
315+
#>
285316
param ([string]$Path)
286317

287318
$directories = @()
288319
$childDirs = Get-ChildItem -Path $Path -Directory
289320

290321
foreach ($dir in $childDirs) {
291322
$directories += $dir.FullName
292-
$directories += Find-TestDirectories -Path $dir.FullName
323+
$directories += Find-TestDirectory -Path $dir.FullName
293324
}
294325

295326
return $directories
296327
}
297328

298-
$allTestFolders = @($testsPath) + (Find-TestDirectories -Path $testsPath)
329+
$allTestFolders = @($testsPath) + (Find-TestDirectory -Path $testsPath)
299330

300331
foreach ($folder in $allTestFolders) {
301332
$testItems = Get-TestItemsFromFolder -FolderPath $folder

tests/Validate-Settings.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Write-Host '=============================================='
3636

3737
# Validate against JSON schema
3838
Write-Host "`nValidating settings against JSON schema..."
39-
$schemaPath = Join-Path $PSScriptRoot '..' 'scripts' 'Settings.schema.json'
39+
$schemaPath = Join-Path -Path $PSScriptRoot -ChildPath '..' -AdditionalChildPath 'scripts', 'Settings.schema.json'
4040
$schema = Get-Content $schemaPath -Raw
4141
$isValid = Test-Json -Json $SettingsJson -Schema $schema
4242

0 commit comments

Comments
 (0)