Skip to content

Update Spectre.Console#26

Open
JohnCampionJr wants to merge 1 commit into
solarwinds:mainfrom
jcamp-code:feature/upgrade-spectre
Open

Update Spectre.Console#26
JohnCampionJr wants to merge 1 commit into
solarwinds:mainfrom
jcamp-code:feature/upgrade-spectre

Conversation

@JohnCampionJr

Copy link
Copy Markdown

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:

  • Commands' ExecuteAsync now takes a CancellationToken and is protected.
  • CommandAppTester/CommandAppResult moved to the new Spectre.Console.Cli.Testing package, and the tester is now single-use, so tests that ran it more than once (bootstrap Init, then run the command) use a fresh tester per run.

Also removes the CommandAppTesterExtensions reflection hack tests now push input through the tester's console.

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.
Copilot AI review requested due to automatic review settings June 8, 2026 19:14
@JohnCampionJr JohnCampionJr requested a review from a team as a code owner June 8, 2026 19:14

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

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.CommandAppTester and 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();

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

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();
Comment thread Directory.Packages.props
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants