Fix the localization tests for the Release Automation environment (#27944)

This commit is contained in:
Dongbo Wang authored and GitHub committed 2026-09-01 15:54:26 -07:00
1 parent 13b2fd1257
commit fcdb9f0c3c
2 files changed
+19 -7

No files matched your search

@@ -1,16 +1,22 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
Describe "Localized resource files validation" -Tags "CI" {
Describe "LocProject.json file validation" -Tags "CI" {
BeforeAll {
$repoRoot = (Resolve-Path (Join-Path $PSScriptRoot ../../../..)).Path
## The 'LocProject.json' tests depend on running from a local PowerShell repo.
$skipTests = $env:PIPELINE_REPOSITORY_NAME -eq 'Release-Automation'
if ($skipTests) {
Write-Host "Skipping 'LocProject.json' tests in Release Automation." -ForegroundColor Yellow
return
}
$repoRoot = (Resolve-Path (Join-Path $PSScriptRoot ../../../..)).Path
$locProjectPath = Join-Path $repoRoot 'Localize' 'LocProject.json'
$content = Get-Content -Path $locProjectPath -Raw
$locProject = ConvertFrom-Json -InputObject $content
$content = Get-Content -Path $locProjectPath -Raw -ErrorAction Stop
$locProject = ConvertFrom-Json -InputObject $content -ErrorAction Stop
}
It 'Validate LocItems in LocProject.json' {
It 'Validate LocItems in LocProject.json' -Skip:$skipTests {
$locProject.Projects.Count | Should -Be 1
$project = $locProject.Projects[0]
$project.LanguageSet | Should -BeExactly 'VS_Main_Languages'
@@ -28,7 +34,7 @@ Describe "Localized resource files validation" -Tags "CI" {
}
}
It 'Validate total resource count' {
It 'Validate total resource count' -Skip:$skipTests {
$srcDir = Join-Path $repoRoot 'src'
$project = $locProject.Projects[0]
@@ -5,6 +5,12 @@ Describe "Localized resource files validation" -Tags "CI" {
BeforeAll {
$repoSrcDir = (Resolve-Path (Join-Path $PSScriptRoot ../../../../src)).Path
$skipSatelliteAssemblyTest = !$IsWindows
if (!$skipSatelliteAssemblyTest -and $env:PIPELINE_REPOSITORY_NAME -eq 'Release-Automation') {
## Only MSIX packages include the localized satellite assemblies.
$isMSIXApp = Test-Path -Path (Join-Path $PSHOME 'AppxManifest.xml')
$skipSatelliteAssemblyTest = -not $isMSIXApp
}
# Folders that exist in 'resources' folder but are not a localized resource directory.
$excludeDirs = @('Graphics')
@@ -87,7 +93,7 @@ Describe "Localized resource files validation" -Tags "CI" {
}
}
It "Satellite assemblies should be produced for '<Language>'" -TestCases $testCases2 -Skip:(!$IsWindows) {
It "Satellite assemblies should be produced for '<Language>'" -TestCases $testCases2 -Skip:$skipSatelliteAssemblyTest {
param($Language)
$satDir = Join-Path $PSHOME $Language