Skip to content

LocProject.Tests.ps1 fails on master: PDP.xml entry violates OutputPath/CopyOption assertions and inflates LocItems count #27987

Description

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues.
  • Refer to the FAQ.
  • Refer to Differences between Windows PowerShell 5.1 and PowerShell.

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:

  1. 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.

  2. 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions