Skip to content

Commit b1128b6

Browse files
authored
Update Node.Tests.ps1
1 parent 4e9fd78 commit b1128b6

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

tests/Node.Tests.ps1

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,24 @@ Describe "Node.js" {
3535
}
3636

3737
It "cached version is used without downloading" {
38-
# Analyze output of previous steps to check if Node.js was consumed from cache or downloaded
39-
$useNodeLogFile = Get-UseNodeLogs
40-
$useNodeLogFile | Should -Exist
41-
$useNodeLogContent = Get-Content $useNodeLogFile -Raw
42-
$useNodeLogContent | Should -Match "Found in cache"
38+
if ($env:RUNNER_TYPE -eq "GitHub") {
39+
# Analyze output of previous steps to check if Node.js was consumed from cache or downloaded
40+
$useNodeLogFile = Get-UseNodeLogs
41+
$useNodeLogFile | Should -Exist
42+
$useNodeLogContent = Get-Content $useNodeLogFile -Raw
43+
$useNodeLogContent | Should -Match "Found in cache"
44+
} else {
45+
# Get the installed version of Node.js
46+
$nodeVersion = Invoke-Expression "node --version"
47+
# Check if Node.js is installed
48+
$nodeVersion | Should -Not -BeNullOrEmpty
49+
# Check if the installed version of Node.js is the expected version
50+
$nodeVersion | Should -Match $env:VERSION
51+
}
4352
}
4453

54+
4555
It "Run simple code" {
4656
"node ./simple-test.js" | Should -ReturnZeroExitCode
4757
}
48-
}
58+
}

0 commit comments

Comments
 (0)