Files
runner-images/images/macos/provision/core/powershell.sh
Darii Nurgaleev 0a9570b623 [macOS] change Invoke-Pester function (#2261)
* [macOS] change Invoke-Pester function

* added new logic

* try another approach.

* invoke-tests change

* added a little bunch of tests.

* remove import from browsers

* added source for all tests covered scripts.

* run all tests.

* added proper module import

* RunAll-Tests.ps1 changes.

* added shebang

* added new approach for tests.

* the first line should be shebang

* fixed nitpicks
2020-12-17 15:37:19 +03:00

39 lines
1.2 KiB
Bash

#!/bin/bash -e -o pipefail
source ~/utils/utils.sh
source ~/utils/invoke-tests.sh
echo Installing Azure CLI...
brew install azure-cli
echo Installing PowerShell...
brew cask install powershell
# A dummy call of `az` to initialize ~/.azure directory before the modules are installed
az -v
# Install PowerShell modules
psModules=$(get_toolset_value '.powershellModules[].name')
for module in ${psModules[@]}; do
echo "Installing $module module"
moduleVersions="$(get_toolset_value ".powershellModules[] | select(.name==\"$module\") | .versions[]?")"
if [[ -z "$moduleVersions" ]];then
pwsh -command "& {Install-Module $module -Force -Scope AllUsers}"
else
for version in ${moduleVersions[@]}; do
echo " - $version"
pwsh -command "& {Install-Module $module -RequiredVersion $version -Force -Scope AllUsers}"
done
fi
done
# A dummy call to initialize .IdentityService directory
pwsh -command "& {Import-Module Az}"
# powershell link was removed in powershell-6.0.0-beta9
sudo ln -s /usr/local/bin/pwsh /usr/local/bin/powershell
# fix ~/.azure directory permissions
sudo chown -R ${USER}: $HOME/.azure
invoke_tests "Powershell"