Add comprehensive PowerShell class tests for ConvertTo-Json#26769
Open
yotsuda wants to merge 3 commits intoPowerShell:masterfrom
Open
Add comprehensive PowerShell class tests for ConvertTo-Json#26769yotsuda wants to merge 3 commits intoPowerShell:masterfrom
yotsuda wants to merge 3 commits intoPowerShell:masterfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Phase 5 “comprehensive” coverage for ConvertTo-Json focused specifically on PowerShell class instances, extending the existing phased test suite for ConvertTo-Json behavior.
Changes:
- Adds basic PowerShell class serialization tests (simple properties, constructors, default values, method exclusion, hidden properties).
- Adds nested-class and inheritance serialization coverage.
- Adds coverage for ETS (extended) properties and mixed arrays containing both class instances and
PSCustomObject.
iSazonov
reviewed
Feb 10, 2026
test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertTo-Json.Tests.ps1
Outdated
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertTo-Json.Tests.ps1
Outdated
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertTo-Json.Tests.ps1
Outdated
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertTo-Json.Tests.ps1
Outdated
Show resolved
Hide resolved
Replace multiple small classes with a single SimpleClass covering all property types (primitive, BigInt, Guid, IPAddress, array, dictionary, hidden, ETS). Remove constructor, method, and separate ETS tests. 14 tests -> 7 tests.
iSazonov
reviewed
Feb 10, 2026
test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertTo-Json.Tests.ps1
Outdated
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertTo-Json.Tests.ps1
Outdated
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertTo-Json.Tests.ps1
Outdated
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertTo-Json.Tests.ps1
Outdated
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertTo-Json.Tests.ps1
Show resolved
Hide resolved
Change all Phase 5 assertions from Match to BeExactly. Use OrderedDictionary for deterministic key order. Add ETS NoteProperty to nested IPVal member.
iSazonov
approved these changes
Feb 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
Add comprehensive PowerShell class tests for
ConvertTo-Json(Phase 5).PR Context
This is a follow-up to #26743. Per @iSazonov's suggestion in #26639, comprehensive tests are being submitted as separate PRs for each phase.
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerTests Added
The following PowerShell class tests are added to
ConvertTo-Json.Tests.ps1.Per review feedback, all property types are consolidated into a single
SimpleClass(primitive, BigInt, Guid, IPAddress, array and ordered dictionary with compound nested elements, hidden, and ETS properties including nested member ETS). All assertions useBeExactly.Total: 7 new tests