mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-20 06:29:50 +00:00
[macOS] Implement new directories hierarchy (#8741)
This commit is contained in:
committed by
GitHub
parent
5d40b1e213
commit
8d6a01b370
56
images/macos/scripts/tests/Node.Tests.ps1
Normal file
56
images/macos/scripts/tests/Node.Tests.ps1
Normal file
@@ -0,0 +1,56 @@
|
||||
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
|
||||
Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" -DisableNameChecking
|
||||
|
||||
$os = Get-OSVersion
|
||||
|
||||
Describe "Node.js" {
|
||||
It "Node.js is installed" {
|
||||
"node --version" | Should -ReturnZeroExitCode
|
||||
}
|
||||
|
||||
It "Node.js version should correspond to the version in the toolset" {
|
||||
node --version | Should -BeLike "v$(Get-ToolsetValue 'node.default')*"
|
||||
}
|
||||
|
||||
It "NPM is installed" {
|
||||
"npm --version" | Should -ReturnZeroExitCode
|
||||
}
|
||||
|
||||
It "Yarn is installed" {
|
||||
"yarn --version" | Should -ReturnZeroExitCode
|
||||
}
|
||||
}
|
||||
|
||||
Describe "nvm" -Skip:($os.IsVentura -or $os.IsSonoma) {
|
||||
BeforeAll {
|
||||
$nvmPath = Join-Path $env:HOME ".nvm" "nvm.sh"
|
||||
$nvmInitCommand = ". $nvmPath > /dev/null 2>&1 || true"
|
||||
}
|
||||
|
||||
It "nvm is installed" {
|
||||
$nvmPath | Should -Exist
|
||||
"$nvmInitCommand && nvm --version" | Should -ReturnZeroExitCode
|
||||
}
|
||||
|
||||
Context "nvm versions" {
|
||||
[array]$nvmVersions = Get-ToolsetValue 'node.nvm_versions'
|
||||
$testCases = $nvmVersions | ForEach-Object { @{NvmVersion = $_} }
|
||||
|
||||
It "<NvmVersion>" -TestCases $testCases {
|
||||
param (
|
||||
[string] $NvmVersion
|
||||
)
|
||||
|
||||
"$nvmInitCommand && nvm ls $($NvmVersion)" | Should -ReturnZeroExitCode
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Global NPM Packages" {
|
||||
$globalNpmPackages = Get-ToolsetValue "npm.global_packages"
|
||||
$globalNpmPackagesWithTests = $globalNpmPackages | Where-Object { $_.test } | ForEach-Object { @{ Name = $_.name; Test = $_.test } }
|
||||
|
||||
It "<Name>" -TestCases $globalNpmPackagesWithTests {
|
||||
$Test | Should -ReturnZeroExitCode
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user