-
-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathIBTasks.tests.ps1
More file actions
42 lines (37 loc) · 1.86 KB
/
Copy pathIBTasks.tests.ps1
File metadata and controls
42 lines (37 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#requires -module InvokeBuild,Psake
Describe 'Invoke-Build Tasks' {
BeforeAll {
$manifest = Import-PowerShellDataFile -Path $env:BHPSModuleManifest
$outputDir = [IO.Path]::Combine($ENV:BHProjectPath, 'Output')
$outputModDir = [IO.Path]::Combine($outputDir, $env:BHProjectName)
$outputModVerDir = [IO.Path]::Combine($outputModDir, $manifest.ModuleVersion)
$ibTasksFilePath = [IO.Path]::Combine($outputModVerDir, 'IB.tasks.ps1')
$psakeFilePath = [IO.Path]::Combine($outputModVerDir, 'psakeFile.ps1')
}
$IBTasksResult = $null
It 'IB.tasks.ps1 exists' {
Test-Path $IBTasksFilePath | Should -Be $true
}
It 'Parseable by invoke-build' {
# Run IB in job to not pollute the environment
# Invoke-Build whatif still outputs in Appveyor in Pester even when directed to out-null. This doesn't happen locally. Redirecting all output to null
$IBTasksResult = Start-Job -ScriptBlock {
Invoke-Build -File $using:IBTasksFilePath -Whatif -Result IBTasksResult -ErrorAction Stop *>$null
$IBTasksResult
} | Wait-Job | Receive-Job
$IBTasksResult | Should -Not -BeNullOrEmpty
}
It 'Contains all the tasks that were in the Psake file' {
# Run psake in job to not pollute the environment
$psakeTaskNames = Start-Job -ScriptBlock {
Invoke-PSake -docs -buildfile $using:psakeFilePath | Where-Object name -notmatch '^(default|\?)$' | ForEach-Object name
} | Wait-Job | Receive-Job
$IBTaskNames = $IBTasksResult.all.name
foreach ($taskItem in $psakeTaskNames) {
if ($taskitem -notin $IBTaskNames) {
throw "Task $taskitem was not successfully converted by Convert-PSAke"
}
}
$Psaketasknames | Should -Not -BeNullOrEmpty
}
}