Update to Pester 5

This commit is contained in:
MaksimZhukov 2020-08-24 20:07:31 +03:00
parent ed56a19091
commit 978acceff5
2 changed files with 14 additions and 23 deletions

View File

@ -104,15 +104,9 @@ jobs:
- name: Run tests
run: |
Install-Module Pester -Force -Scope CurrentUser -RequiredVersion 4.10.1
Install-Module Pester -Force -Scope CurrentUser
Import-Module Pester
$pesterParams = @{
Path="./Node.Tests.ps1";
Parameters=@{
Version="$env:VERSION";
}
}
Invoke-Pester -Script $pesterParams -EnableExit
Invoke-Pester -Script ./Node.Tests.ps1 -EnableExit
working-directory: ./tests
publish_release:

View File

@ -1,20 +1,17 @@
param (
[Version] [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()]
$Version
)
Import-Module (Join-Path $PSScriptRoot "../helpers/pester-extensions.psm1")
function Get-UseNodeLogs {
# GitHub Windows images don't have `HOME` variable
$homeDir = $env:HOME ?? $env:HOMEDRIVE
$logsFolderPath = Join-Path -Path $homeDir -ChildPath "runners/*/_diag/pages" -Resolve
BeforeAll {
function Get-UseNodeLogs {
# GitHub Windows images don't have `HOME` variable
$homeDir = $env:HOME ?? $env:HOMEDRIVE
$logsFolderPath = Join-Path -Path $homeDir -ChildPath "runners/*/_diag/pages" -Resolve
$useNodeLogFile = Get-ChildItem -Path $logsFolderPath | Where-Object {
$logContent = Get-Content $_.Fullname -Raw
return $logContent -match "setup-node@v"
} | Select-Object -First 1
return $useNodeLogFile.Fullname
$useNodeLogFile = Get-ChildItem -Path $logsFolderPath | Where-Object {
$logContent = Get-Content $_.Fullname -Raw
return $logContent -match "setup-node@v"
} | Select-Object -First 1
return $useNodeLogFile.Fullname
}
}
Describe "Node.js" {
@ -24,7 +21,7 @@ Describe "Node.js" {
It "version is correct" {
$versionOutput = Invoke-Expression "node --version"
$versionOutput | Should -Match $Version
$versionOutput | Should -Match $env:VERSION
}
It "is used from tool-cache" {