Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Commit 98bdd81

Browse files
committed
Use Import-PowerShellDataFile if available
1 parent aae1f6d commit 98bdd81

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

OperationValidation/Public/Get-OperationValidation.ps1

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
function Get-OperationValidation {
32
<#
43
.SYNOPSIS
@@ -159,6 +158,9 @@ function Get-OperationValidation {
159158
[Alias('PSPath')]
160159
[string[]]$LiteralPath,
161160

161+
# [Parameter(ParameterSetName = 'ModuleName')]
162+
# [Parameter(ParameterSetName = 'Path')]
163+
# [Parameter(ParameterSetName = 'LiteralPath')]
162164
[ValidateSet('Simple', 'Comprehensive')]
163165
[string[]]$TestType = @('Simple', 'Comprehensive'),
164166

@@ -221,8 +223,11 @@ function Get-OperationValidation {
221223

222224
# Some OVF modules might not have a manifest (.psd1) file.
223225
if ($manifestFile) {
224-
$manifest = Parse-Psd1 $manifestFile.FullName
225-
#$manifest = Test-ModuleManifest -Path $manifestFile.FullName -Verbose:$false -ErrorAction SilentlyContinue
226+
if ($PSVersionTable.PSVersion -ge 5) {
227+
$manifest = Import-PowerShellDataFile -Path $manifestFile.FullName
228+
} else {
229+
$manifest = Parse-Psd1 $manifestFile.FullName
230+
}
226231
}
227232
else
228233
{
@@ -238,7 +243,7 @@ function Get-OperationValidation {
238243
{
239244
continue
240245
}
241-
foreach($file in (Get-ChildItem -Path $testDir -Filter *.tests.ps1))
246+
foreach($file in (Get-ChildItem -Path $testDir | Where-Object {$_.Name -like '*.tests.ps1'}))
242247
{
243248
# Pull out parameters to Pester script if they exist
244249
$script = Get-Command -Name $file.fullname

0 commit comments

Comments
 (0)