Prerequisites
Steps to reproduce
Both tests in test/powershell/engine/ResourceValidation/LocProject.Tests.ps1 fail on a clean master checkout with no other changes applied. This surfaces as a Unelevated CI failure on Windows, Linux, and macOS, which in turn fails the ready to merge / all jobs passed gate for unrelated PRs.
Reproduced at b664c2e026d1610e9b5a6cc5b14d3c86aae9ab81 ("Add PDP.xml to the LocProject.json file for localization", #27966):
git clone https://github.com/PowerShell/PowerShell.git
cd PowerShell
Import-Module ./build.psm1
Start-PSBuild
Start-PSPester -Path test/powershell/engine/ResourceValidation/LocProject.Tests.ps1
The Localize/LocProject.json entry added in #27966 is the only entry that violates the test's assertions:
{
"SourceFile": ".pipelines\\store\\PDPs\\PDP\\en-US\\PDP.xml",
"OutputPath": ".pipelines\\store\\PDPs\\PDP\\",
"CopyOption": "LangIDOnPath"
}
There are two independent problems:
-
OutputPath and CopyOption mismatch. The test derives the expected OutputPath as the direct parent of SourceFile (...\PDP\en-US\) and requires CopyOption to be LangIDOnPathAndName. This entry sets the grandparent (...\PDP\) and LangIDOnPath. Note the second assertion is currently masked, because the test fails on OutputPath first.
-
Resource count mismatch. Validate total resource count compares LocItems.Count against the number of *.resx files in resources directories under src. PDP.xml is not a .resx file under src, but it is counted in LocItems, so the totals differ by exactly one (151 vs 150).
I verified that only this one entry is affected — the other 150 entries satisfy all three assertions.
Expected behavior
Describing LocProject.json file validation
[+] Validate LocItems in LocProject.json
[+] Validate total resource count
Tests Passed: 2, Failed: 0
Actual behavior
Describing LocProject.json file validation
[-] Validate LocItems in LocProject.json 259ms
Expected strings to be the same, but they were different.
Expected length: 32
Actual length: 26
Strings differ at index 26.
Expected: '.pipelines\store\PDPs\PDP\en-US\'
But was: '.pipelines\store\PDPs\PDP\'
32: $_.OutputPath | Should -BeExactly "$parentDir\"
at <ScriptBlock>, /home/runner/work/PowerShell/PowerShell/test/powershell/engine/ResourceValidation/LocProject.Tests.ps1: line 32
[-] Validate total resource count 99ms
Expected 150, but got 151.
51: $project.LocItems.Count | Should -Be $totalResourceCount
at <ScriptBlock>, /home/runner/work/PowerShell/PowerShell/test/powershell/engine/ResourceValidation/LocProject.Tests.ps1: line 51
Tests Passed: 0, Failed: 2
Environment data
Name Value
---- -----
PSVersion 7.7.0-preview.4
GitCommitId 7.7.0-preview.4
OS Darwin 24.6.0 (arm64)
Platform Unix
Repro commit: b664c2e026d1610e9b5a6cc5b14d3c86aae9ab81 (master)
Also observed in CI on windows-latest, ubuntu-latest, and macos-latest.
Visuals
Not applicable.
Additional context
The localization metadata for PDP.xml may well be intentional, since it is a Store PDP file rather than a managed .resx resource. If so, the fix likely belongs in the test rather than in LocProject.json: the assertions currently encode a src/**/resources/*.resx-only assumption in both the OutputPath/CopyOption checks and the resource-count comparison, and would need to accommodate non-.resx localization entries outside src.
Found while working on #27387, which touches no localization or pipeline files.
Prerequisites
Steps to reproduce
Both tests in
test/powershell/engine/ResourceValidation/LocProject.Tests.ps1fail on a cleanmastercheckout with no other changes applied. This surfaces as aUnelevated CIfailure on Windows, Linux, and macOS, which in turn fails theready to merge / all jobs passedgate for unrelated PRs.Reproduced at
b664c2e026d1610e9b5a6cc5b14d3c86aae9ab81("AddPDP.xmlto theLocProject.jsonfile for localization", #27966):The
Localize/LocProject.jsonentry added in #27966 is the only entry that violates the test's assertions:{ "SourceFile": ".pipelines\\store\\PDPs\\PDP\\en-US\\PDP.xml", "OutputPath": ".pipelines\\store\\PDPs\\PDP\\", "CopyOption": "LangIDOnPath" }There are two independent problems:
OutputPathandCopyOptionmismatch. The test derives the expectedOutputPathas the direct parent ofSourceFile(...\PDP\en-US\) and requiresCopyOptionto beLangIDOnPathAndName. This entry sets the grandparent (...\PDP\) andLangIDOnPath. Note the second assertion is currently masked, because the test fails onOutputPathfirst.Resource count mismatch.
Validate total resource countcomparesLocItems.Countagainst the number of*.resxfiles inresourcesdirectories undersrc.PDP.xmlis not a.resxfile undersrc, but it is counted inLocItems, so the totals differ by exactly one (151 vs 150).I verified that only this one entry is affected — the other 150 entries satisfy all three assertions.
Expected behavior
Actual behavior
Environment data
Visuals
Not applicable.
Additional context
The localization metadata for
PDP.xmlmay well be intentional, since it is a Store PDP file rather than a managed.resxresource. If so, the fix likely belongs in the test rather than inLocProject.json: the assertions currently encode asrc/**/resources/*.resx-only assumption in both theOutputPath/CopyOptionchecks and the resource-count comparison, and would need to accommodate non-.resxlocalization entries outsidesrc.Found while working on #27387, which touches no localization or pipeline files.