Skip to content

Add comprehensive PowerShell class tests for ConvertTo-Json#26769

Open
yotsuda wants to merge 3 commits intoPowerShell:masterfrom
yotsuda:add-convertto-json-class-tests
Open

Add comprehensive PowerShell class tests for ConvertTo-Json#26769
yotsuda wants to merge 3 commits intoPowerShell:masterfrom
yotsuda:add-convertto-json-class-tests

Conversation

@yotsuda
Copy link
Contributor

@yotsuda yotsuda commented Feb 10, 2026

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

Tests 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 use BeExactly.

Context Tests Description
PowerShell class serialization 2 comprehensive SimpleClass with all property types + ETS, default values
Nested PowerShell class 2 deeply nested (3-level), null child
PowerShell class inheritance 2 derived class, multi-level inheritance
Mixed PSCustomObject and PowerShell class 1 mixed type array (class + PSCustomObject)

Total: 7 new tests

Copilot AI review requested due to automatic review settings February 10, 2026 08:07
@yotsuda yotsuda requested a review from a team as a code owner February 10, 2026 08:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 iSazonov added the CL-Test Indicates that a PR should be marked as a test change in the Change Log label Feb 10, 2026
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 iSazonov self-assigned this Feb 10, 2026
Change all Phase 5 assertions from Match to BeExactly. Use OrderedDictionary
for deterministic key order. Add ETS NoteProperty to nested IPVal member.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-Test Indicates that a PR should be marked as a test change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants