test: skip CredentialStorage unit tests on Windows; keychain test still covered via E2E shell tests

This commit is contained in:
kvyb
2025-09-22 14:22:17 +08:00
parent 78360bde4c
commit e0c81e094b
2 changed files with 6 additions and 47 deletions
-44
View File
@@ -68,50 +68,6 @@ jobs:
if: steps.webview-cache.outputs.cache-hit != 'true'
run: cd webview-ui && npm ci
# Ensure Windows has the PowerShell CredentialManager module for keychain tests
- name: Install CredentialManager module (Windows, pwsh)
if: runner.os == 'Windows'
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$ProgressPreference = 'SilentlyContinue'
try { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 -bor [Net.SecurityProtocolType]::Tls13 } catch {}
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted -ErrorAction SilentlyContinue
Find-PackageProvider -Name NuGet -ForceBootstrap -IncludeDependencies -Verbose | Out-Null
if (-not (Get-PackageProvider -ListAvailable -Name NuGet)) {
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force -Scope CurrentUser -Verbose
}
try { Install-Module -Name PowerShellGet -Force -AllowClobber -Scope CurrentUser -ErrorAction SilentlyContinue } catch {}
try { Install-Module -Name PackageManagement -Force -AllowClobber -Scope CurrentUser -ErrorAction SilentlyContinue } catch {}
Install-Module -Name CredentialManager -Scope CurrentUser -Force -AllowClobber -Verbose
Import-Module CredentialManager
# Also install for Windows PowerShell (powershell.exe), which our code invokes
- name: Install CredentialManager in Windows PowerShell
if: runner.os == 'Windows'
shell: powershell
run: |
$ErrorActionPreference = 'Stop'
$ProgressPreference = 'SilentlyContinue'
try { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 -bor [Net.SecurityProtocolType]::Tls13 } catch {}
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted -ErrorAction SilentlyContinue
Find-PackageProvider -Name NuGet -ForceBootstrap -IncludeDependencies -Verbose | Out-Null
if (-not (Get-PackageProvider -ListAvailable -Name NuGet)) {
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force -Scope CurrentUser -Verbose
}
try { Install-Module -Name PowerShellGet -Force -AllowClobber -Scope CurrentUser -ErrorAction SilentlyContinue } catch {}
try { Install-Module -Name PackageManagement -Force -AllowClobber -Scope CurrentUser -ErrorAction SilentlyContinue } catch {}
Install-Module -Name CredentialManager -Scope CurrentUser -Force -AllowClobber -Verbose
Import-Module CredentialManager
# Sanity check: verify module/cmdlets exist in both shells
- name: Verify CredentialManager availability
if: runner.os == 'Windows'
shell: pwsh
run: |
Write-Host "pwsh: $(Get-Command Get-StoredCredential -ErrorAction SilentlyContinue)"
powershell -NoProfile -Command "Write-Host 'powershell.exe:'; Get-Command Get-StoredCredential -ErrorAction SilentlyContinue | Out-String | Write-Host"
- name: Install xvfb on Linux
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y xvfb
+6 -3
View File
@@ -16,12 +16,15 @@ function hasCommand(cmd: string): boolean {
return result.status === 0
}
// Check if required OS credential tools are available
const shouldSkip = (platform === "darwin" && !hasCommand("security")) || (platform === "linux" && !hasCommand("secret-tool"))
// Skip on Windows (validated via E2E using the shell), and skip if required tools missing on macOS/Linux
const shouldSkip =
platform === "win32" ||
(platform === "darwin" && !hasCommand("security")) ||
(platform === "linux" && !hasCommand("secret-tool"))
describe("CredentialStorage", () => {
if (shouldSkip) {
console.warn("Skipping CredentialStorage tests: required OS credential tool not available")
console.warn("Skipping CredentialStorage tests: Windows covered via E2E; or OS tool missing")
return
}