Files
runner-images/images/macos/tests/Node.Tests.ps1
T

65 lines
1.7 KiB
PowerShell
Raw Normal View History

2020-09-10 14:34:08 +03:00
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" -DisableNameChecking
2020-09-10 14:34:08 +03:00
$os = Get-OSVersion
Describe "Node.js" {
2020-09-10 14:34:08 +03:00
BeforeAll {
$os = Get-OSVersion
2020-11-05 10:38:20 +03:00
$expectedNodeVersion = if ($os.IsHigherThanMojave) { "v14.*" } else { "v8.*" }
2020-09-10 14:34:08 +03:00
}
It "Node.js is installed" {
2020-09-10 14:34:08 +03:00
"node --version" | Should -ReturnZeroExitCode
}
It "Node.js $expectedNodeVersion is default" {
2020-09-10 14:34:08 +03:00
(Get-CommandResult "node --version").Output | Should -BeLike $expectedNodeVersion
}
It "NPM is installed" {
"npm --version" | Should -ReturnZeroExitCode
}
It "Yarn is installed" {
"yarn --version" | Should -ReturnZeroExitCode
}
}
Describe "nvm" {
2020-09-10 14:34:08 +03:00
BeforeAll {
$nvmPath = Join-Path $env:HOME ".nvm" "nvm.sh"
$nvmInitCommand = ". $nvmPath > /dev/null 2>&1 || true"
}
2020-11-05 10:38:20 +03:00
It "nvm is installed" {
2020-09-10 14:34:08 +03:00
$nvmPath | Should -Exist
"$nvmInitCommand && nvm --version" | Should -ReturnZeroExitCode
}
Context "nvm versions" {
2020-09-10 14:34:08 +03:00
$NVM_VERSIONS = @(6, 8, 10, 12)
$testCases = $NVM_VERSIONS | ForEach-Object { @{NvmVersion = $_} }
It "<NvmVersion>" -TestCases $testCases {
param (
[string] $NvmVersion
)
2020-11-05 10:38:20 +03:00
2020-09-10 14:34:08 +03:00
"$nvmInitCommand && nvm ls $($NvmVersion)" | Should -ReturnZeroExitCode
}
}
}
Describe "AppCenterCLI" {
It "App Center CLI" {
"appcenter --version" | Should -ReturnZeroExitCode
}
}
Describe "Newman" -Skip:($os.IsHighSierra -or $os.IsMojave) {
It "Newman" {
"newman --version" | Should -ReturnZeroExitCode
}
}