mirror of
https://github.com/actions/runner-images.git
synced 2025-12-20 06:35:47 +00:00
[macOS] Implement new directories hierarchy (#8741)
This commit is contained in:
committed by
GitHub
parent
5d40b1e213
commit
8d6a01b370
43
images/macos/scripts/tests/Powershell.Tests.ps1
Normal file
43
images/macos/scripts/tests/Powershell.Tests.ps1
Normal file
@@ -0,0 +1,43 @@
|
||||
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
|
||||
Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" -DisableNameChecking
|
||||
|
||||
Describe "Powershell" {
|
||||
Context "Powershell is installed" {
|
||||
It "Powershell is installed" {
|
||||
"pwsh -v" | Should -ReturnZeroExitCode
|
||||
}
|
||||
}
|
||||
|
||||
Context "Powershell Modules" {
|
||||
$modules = Get-ToolsetValue powershellModules
|
||||
$withoutVersionsModules = $modules | Where-Object {-not $_.versions} | ForEach-Object {
|
||||
@{moduleName = $_.name}
|
||||
}
|
||||
|
||||
$withVersionsModules = $modules | Where-Object {$_.versions} | ForEach-Object {
|
||||
$moduleName = $_.name
|
||||
$_.versions | ForEach-Object {
|
||||
@{moduleName = $moduleName; expectedVersion = $_}
|
||||
}
|
||||
}
|
||||
|
||||
It "<moduleName> is installed" -TestCases $withoutVersionsModules {
|
||||
param (
|
||||
[string] $moduleName
|
||||
)
|
||||
|
||||
Get-Module -Name $moduleName -ListAvailable | Should -BeTrue
|
||||
}
|
||||
|
||||
if ($withVersionsModules) {
|
||||
It "<moduleName> with <expectedVersion> is installed" -TestCases $withVersionsModules {
|
||||
param (
|
||||
[string] $moduleName,
|
||||
[string] $expectedVersion
|
||||
)
|
||||
|
||||
(Get-Module -Name $moduleName -ListAvailable).Version -contains $expectedVersion | Should -BeTrue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user