2020-09-10 14:34:08 +03:00
|
|
|
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
|
2021-01-14 12:17:44 +03:00
|
|
|
Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" -DisableNameChecking
|
2020-09-10 14:34:08 +03:00
|
|
|
|
2021-01-29 16:37:48 +07:00
|
|
|
$os = Get-OSVersion
|
|
|
|
|
|
2020-12-23 22:14:13 +07:00
|
|
|
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
|
|
|
}
|
|
|
|
|
|
2020-12-23 22:14:13 +07:00
|
|
|
It "Node.js is installed" {
|
2020-09-10 14:34:08 +03:00
|
|
|
"node --version" | Should -ReturnZeroExitCode
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-23 22:14:13 +07:00
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-23 22:14:13 +07:00
|
|
|
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
|
|
|
|
2020-12-23 22:14:13 +07:00
|
|
|
It "nvm is installed" {
|
2020-09-10 14:34:08 +03:00
|
|
|
$nvmPath | Should -Exist
|
|
|
|
|
"$nvmInitCommand && nvm --version" | Should -ReturnZeroExitCode
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-23 22:14:13 +07:00
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-01-29 16:37:48 +07:00
|
|
|
|
|
|
|
|
Describe "AppCenterCLI" {
|
|
|
|
|
It "App Center CLI" {
|
|
|
|
|
"appcenter --version" | Should -ReturnZeroExitCode
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Describe "Newman" -Skip:($os.IsHighSierra -or $os.IsMojave) {
|
|
|
|
|
It "Newman" {
|
|
|
|
|
"newman --version" | Should -ReturnZeroExitCode
|
|
|
|
|
}
|
|
|
|
|
}
|