Update Spectre.Console#26
Open
JohnCampionJr wants to merge 1 commit into
Open
Conversation
Updates Spectre.Console to 0.56.0 and Spectre.Console.Cli to 0.55.0 (not released in lockstep), plus the matching testing packages. Adapts to two breaking changes: commands' ExecuteAsync now takes a CancellationToken and is protected, and CommandAppTester/CommandAppResult moved to the new Spectre.Console.Cli.Testing package and is now single-use (tests that ran it more than once use a fresh tester per run). Removes the CommandAppTesterExtensions reflection hack now that input can go through the tester's own console.
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Upgrades Spectre.Console/Spectre.Console.Cli and adjusts the command/test infrastructure to match the new ExecuteAsync(CommandContext, CancellationToken) signature and the relocation of CommandAppTester.
Changes:
- Bumps Spectre.Console packages and adds
Spectre.Console.Cli.Testing. - Updates command base/command implementations to the new
ExecuteAsync(..., CancellationToken)method signature. - Refactors tests to use
Spectre.Console.Cli.Testing.CommandAppTesterand removes the reflection-based custom console runner.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/SolarWinds.Changesets.Tests/Version/VersionChangesetCommandTests.cs | Switches test import to the new Spectre.Console.Cli.Testing namespace. |
| tests/SolarWinds.Changesets.Tests/Status/StatusChangesetCommandTests.cs | Uses Spectre.Console.Cli.Testing and runs init via a separate tester during setup. |
| tests/SolarWinds.Changesets.Tests/Publish/PublishChangesetCommandTests.cs | Uses Spectre.Console.Cli.Testing and runs init via a separate tester during setup. |
| tests/SolarWinds.Changesets.Tests/Init/InitCommandTests.cs | Refactors app creation to adapt to updated testing API usage. |
| tests/SolarWinds.Changesets.Tests/Add/CommandAppTesterExtensions.cs | Removes reflection-based helper no longer needed after package upgrade. |
| tests/SolarWinds.Changesets.Tests/Add/AddCommandTests.cs | Migrates interactive console input to the tester’s built-in console and uses CLI testing package. |
| tests/SolarWinds.Changesets.Tests/SolarWinds.Changesets.Tests.csproj | Adds reference to Spectre.Console.Cli.Testing. |
| src/SolarWinds.Changesets/Shared/ConfigurationCommandBase.cs | Updates command override signature to include CancellationToken. |
| src/SolarWinds.Changesets/Commands/Init/InitChangesetCommand.cs | Updates command override signature/docs to include CancellationToken. |
| Directory.Packages.props | Bumps Spectre.Console package versions and adds CLI testing version. |
| .changeset/upgrade-spectre-console.md | Adds changeset entry documenting the upgrade and API changes. |
Comment on lines
25
to
+29
| TypeRegistrar typeRegistrar = new(serviceCollection); | ||
|
|
||
| CommandAppTester initApp = new(typeRegistrar); | ||
| initApp.SetDefaultCommand<InitChangesetCommand>(); | ||
| initApp.Run(); |
Author
There was a problem hiding this comment.
these are left unchanged from prior code, left alone for consistency.
Comment on lines
33
to
+37
| TypeRegistrar typeRegistrar = new(serviceCollection); | ||
|
|
||
| CommandAppTester initApp = new(typeRegistrar); | ||
| initApp.SetDefaultCommand<InitChangesetCommand>(); | ||
| initApp.Run(); |
Comment on lines
+55
to
+57
| CommandAppTester initApp = new(_typeRegistrar); | ||
| initApp.SetDefaultCommand<InitChangesetCommand>(); | ||
| await initApp.RunAsync(); |
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.
Part of #16.
Updates Spectre.Console to 0.56.0 and Spectre.Console.Cli to 0.55.0, plus the matching testing packages.
Two breaking changes adapted:
Also removes the CommandAppTesterExtensions reflection hack tests now push input through the tester's console.