Skip to content

Commit 454df48

Browse files
committed
🧪 Tests for PSDependOptions
1 parent 98b8346 commit 454df48

3 files changed

Lines changed: 51 additions & 30 deletions

File tree

ModuleFast.tests.ps1

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,13 @@ Describe 'Install-ModuleFast' -Tag 'E2E' {
624624
}
625625
)
626626

627+
It 'Fails if PSDepend File has PSDependOptions DependencyType set' {
628+
$SCRIPT:Mocks = Resolve-Path "$PSScriptRoot/Test/Mocks"
629+
$specFilePath = Join-Path $Mocks 'PSDepend-NotSupported.psd1'
630+
{ Install-ModuleFast @imfParams -Path $specFilePath -Plan }
631+
| Should -Throw '*DependencyType*'
632+
}
633+
627634
It 'Fails for script if #Requires is not Present' {
628635
$scriptPath = Join-Path $testDrive 'norequires.ps1'
629636
{
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@{
2+
PSDependOptions = @{
3+
Repository = 'PSGallery'
4+
DependencyType = 'FileDownload'
5+
}
6+
7+
nuget = @{
8+
Source = 'https://dist.nuget.org/win-x86-commandline/latest/nuget.exe'
9+
Target = 'C:\nuget.exe'
10+
}
11+
}

Test/Mocks/PSDepend.psd1

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,36 @@
11
@{
2-
psdeploy = 'latest'
3-
psake = 'latest'
4-
Pester = 'latest'
5-
BuildHelpers = '0.0.20' # I don't trust this Warren guy...
6-
'PSGalleryModule::InvokeBuild' = 'latest'
7-
'GitHub::RamblingCookieMonster/PSNeo4j' = 'master'
8-
'RamblingCookieMonster/PowerShell' = 'master'
9-
buildhelpers_0_0_20 = @{
10-
Name = 'buildhelpers'
11-
DependencyType = 'PSGalleryModule'
12-
Parameters = @{
13-
Repository = 'PSGallery'
14-
SkipPublisherCheck = $true
15-
}
16-
Version = '0.0.20'
17-
Tags = 'prod', 'test'
18-
PreScripts = 'C:\RunThisFirst.ps1'
19-
DependsOn = 'some_task'
20-
}
2+
PSDependOptions = @{
3+
Repository = 'PSGallery'
4+
} #Should be ignored
5+
psdeploy = 'latest'
6+
psake = 'latest'
7+
Pester = 'latest'
8+
BuildHelpers = '0.0.20' # I don't trust this Warren guy...
9+
'PSGalleryModule::InvokeBuild' = 'latest'
10+
'GitHub::RamblingCookieMonster/PSNeo4j' = 'master'
11+
'RamblingCookieMonster/PowerShell' = 'master'
12+
buildhelpers_0_0_20 = @{
13+
Name = 'buildhelpers'
14+
DependencyType = 'PSGalleryModule'
15+
Parameters = @{
16+
Repository = 'PSGallery'
17+
SkipPublisherCheck = $true
18+
}
19+
Version = '0.0.20'
20+
Tags = 'prod', 'test'
21+
PreScripts = 'C:\RunThisFirst.ps1'
22+
DependsOn = 'some_task'
23+
}
2124

22-
some_task = @{
23-
DependencyType = 'task'
24-
Target = 'C:\RunThisFirst.ps1'
25-
DependsOn = 'nuget'
26-
}
25+
some_task = @{
26+
DependencyType = 'task'
27+
Target = 'C:\RunThisFirst.ps1'
28+
DependsOn = 'nuget'
29+
}
2730

28-
nuget = @{
29-
DependencyType = 'FileDownload'
30-
Source = 'https://dist.nuget.org/win-x86-commandline/latest/nuget.exe'
31-
Target = 'C:\nuget.exe'
32-
}
33-
}
31+
nuget = @{
32+
DependencyType = 'FileDownload'
33+
Source = 'https://dist.nuget.org/win-x86-commandline/latest/nuget.exe'
34+
Target = 'C:\nuget.exe'
35+
}
36+
}

0 commit comments

Comments
 (0)