From 5c75f27e7e2c6ad750befed72e3ba18f24142864 Mon Sep 17 00:00:00 2001 From: gowridurgad <159780674+gowridurgad@users.noreply.github.com> Date: Fri, 28 Jun 2024 12:09:24 +0530 Subject: [PATCH] Update Node.Tests.ps1 --- tests/Node.Tests.ps1 | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/Node.Tests.ps1 b/tests/Node.Tests.ps1 index a2caff2..631fd69 100644 --- a/tests/Node.Tests.ps1 +++ b/tests/Node.Tests.ps1 @@ -2,17 +2,14 @@ Import-Module (Join-Path $PSScriptRoot "../helpers/pester-extensions.psm1") BeforeAll { function Get-UseNodeLogs { - # if ($env:SELF_HOSTED_RUNNER -eq 'true') { - # Set the correct path for your self-hosted runner - # $logsFolderPath = "C:\Users\runneradmin\runners\_diag\pages" - #} else { + # 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 { + $useNodeLogFile = Get-ChildItem -Path $logsFolderPath -ErrorAction SilentlyContinue | Where-Object { $logContent = Get-Content $_.Fullname -Raw return $logContent -match "setup-node@v" - } | Select-Object -First 1 + } | Select-Object -First 1 return $useNodeLogFile.Fullname } }