Skip to content

Add readable pretty-JSON output and validation tests - #61

Merged
mattleibow merged 8 commits into
mainfrom
pr56c/05-f-output-validation
Feb 17, 2026
Merged

mattleibow merged 8 commits into
mainfrom
pr56c/05-f-output-validation

Conversation

@mattleibow

@mattleibow mattleibow commented Feb 17, 2026 •

Copy link
Copy Markdown
Collaborator

Why this change matters

Compact JSON is useful for scripts, but hard to read when inspecting CLI output manually. This PR adds an explicit pretty-JSON mode while preserving existing compact JSON behavior.

What is included

  • Added OutputFormat.JsonPretty in Program.cs.
  • Updated OutputFormatTypeConverter to parse both jsonpretty and json-pretty (case-insensitive), and to safely handle null/empty values by returning OutputFormat.None.
  • Updated OutputHelper to support pretty JSON across all output overloads while keeping compact JSON for OutputFormat.Json.
  • Kept machine-readable JSON/XML output on Console.Write/WriteLine and table rendering on AnsiConsole.
  • Expanded test coverage:
    • OutputHelper_Tests for compact JSON, pretty JSON, XML, table output, and output capture.
    • CommandSettingsValidation_Tests for AVD settings validation and output-format converter aliases.
  • Updated AndroidSdk.Tests.csproj with the AndroidSdk.Tool project reference plus Spectre.Console dependencies needed by the new tests.

Validation

  • dotnet build --nologo --verbosity minimal
  • dotnet test AndroidSdk.Tests/AndroidSdk.Tests.csproj --configuration Release --no-build --nologo --verbosity minimal --filter "FullyQualifiedName~OutputHelper_Tests|FullyQualifiedName~CommandSettingsValidation_Tests"

@mattleibow mattleibow changed the title feat: PR-F output format + validation harness feat: add jsonpretty output mode and validation tests Feb 17, 2026
@github-actions

github-actions Bot commented Feb 17, 2026 •

Copy link
Copy Markdown

Test Results

90 tests  +14   87 ✅ +14   23m 10s ⏱️ + 1m 48s
 2 suites ± 0    3 💤 ± 0 
 2 files   ± 0    0 ❌ ± 0 

Results for commit 765ae50. ± Comparison against base commit 58f891c.

♻️ This comment has been updated with latest results.

@mattleibow
mattleibow force-pushed the pr56c/04-e-emulator-lifecycle branch from 953a2e5 to 952bd94 Compare February 17, 2026 14:37
@mattleibow
mattleibow force-pushed the pr56c/05-f-output-validation branch from 35973ca to f6c6a27 Compare February 17, 2026 14:37
@mattleibow mattleibow changed the title feat: add jsonpretty output mode and validation tests Add readable pretty-JSON output and validation tests Feb 17, 2026
@mattleibow
mattleibow force-pushed the pr56c/05-f-output-validation branch 2 times, most recently from ab2e2bb to 2d64967 Compare February 17, 2026 18:20
@mattleibow
mattleibow force-pushed the pr56c/04-e-emulator-lifecycle branch from dc3f753 to 660ed0f Compare February 17, 2026 18:20
@mattleibow
mattleibow force-pushed the pr56c/05-f-output-validation branch from 2d64967 to 9396625 Compare February 17, 2026 19:17
@mattleibow
mattleibow changed the base branch from pr56c/04-e-emulator-lifecycle to main February 17, 2026 19:17
@mattleibow
mattleibow requested a review from Copilot February 17, 2026 19:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a new OutputFormat.JsonPretty option to provide human-readable, indented JSON output while preserving the existing compact JSON format. This addresses the previous breaking change where JSON output was changed from indented to compact, now offering both options explicitly.

Changes:

  • Added OutputFormat.JsonPretty enum value for indented JSON output
  • Updated OutputHelper to support the new format and changed visibility to public for testing
  • Enhanced OutputFormatTypeConverter to parse "jsonpretty" string input
  • Added comprehensive tests for output formatting and command settings validation

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
AndroidSdk.Tool/Program.cs Added JsonPretty enum value to OutputFormat
AndroidSdk.Tool/OutputHelper.cs Changed visibility to public, updated JsonSerialize signature to support indentation, added JsonPretty handling in all output methods, switched from AnsiConsole to Console for JSON/XML output
AndroidSdk.Tool/OutputFormatTypeConverter.cs Added conversion logic for "jsonpretty" string to OutputFormat.JsonPretty
AndroidSdk.Tests/OutputHelper_Tests.cs New test file with comprehensive output format validation tests
AndroidSdk.Tests/CommandSettingsValidation_Tests.cs New test file validating AVD command settings and output format converter
AndroidSdk.Tests/AndroidSdk.Tests.csproj Added Spectre.Console dependencies and AndroidSdk.Tool project reference

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread AndroidSdk.Tests/OutputHelper_Tests.cs Outdated
Comment thread AndroidSdk.Tests/OutputHelper_Tests.cs
Comment thread AndroidSdk.Tests/OutputHelper_Tests.cs Outdated
Comment thread AndroidSdk.Tool/OutputFormatTypeConverter.cs Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread AndroidSdk.Tests/OutputHelper_Tests.cs
Comment thread AndroidSdk.Tests/CommandSettingsValidation_Tests.cs
Comment thread AndroidSdk.Tests/OutputHelper_Tests.cs Outdated
mattleibow added a commit that referenced this pull request Feb 17, 2026
Adds OutputFormat.JsonPretty support with 'json-pretty' alias. Comprehensive tests for all OutputFormat options including Json, JsonPretty, Xml, and Table formats. Fixes NRE in OutputFormatTypeConverter.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
mattleibow and others added 6 commits February 17, 2026 23:20
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…nd comprehensive format coverage

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Remove unused using in OutputHelper_Tests
- Add tests for OutputFormat.JsonPretty with IEnumerable and single item overloads
- Update OutputFormatTypeConverter to support 'json-pretty' alias
- Add test for 'json-pretty' alias support
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mattleibow
mattleibow force-pushed the pr56c/05-f-output-validation branch from a7064f0 to 0640a34 Compare February 17, 2026 21:20
mattleibow and others added 2 commits February 17, 2026 23:28
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mattleibow
mattleibow merged commit 13f755b into main Feb 17, 2026
5 checks passed
@mattleibow
mattleibow deleted the pr56c/05-f-output-validation branch February 17, 2026 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants