Skip to content

Conversation

@mwbrooks
Copy link
Member

Summary

This pull request updates all CobraCommand.Execute references to use CobraCommand.ExecuteContext.

While minor, it will help prevent future code from using the .Execute syntax and encourage the use of .ExecuteContext. As we begin to rely on the context values, this will help ensure consistent and reliable tests.

Requirements

@mwbrooks mwbrooks added code health M-T: Test improvements and anything that improves code health semver:patch Use on pull requests to describe the release version increment labels Apr 22, 2025
@mwbrooks mwbrooks added this to the Next Release milestone Apr 22, 2025
@mwbrooks mwbrooks self-assigned this Apr 22, 2025
@codecov
Copy link

codecov bot commented Apr 22, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 62.92%. Comparing base (8ec404c) to head (c17dffa).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #58   +/-   ##
=======================================
  Coverage   62.92%   62.92%           
=======================================
  Files         210      210           
  Lines       22156    22156           
=======================================
  Hits        13942    13942           
  Misses       7130     7130           
  Partials     1084     1084           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

listPkgMock.On("List").Return(nil)

err := cmd.Execute()
err := cmd.ExecuteContext(ctx)
Copy link
Member Author

Choose a reason for hiding this comment

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

note: This is pretty much what ever change looks like 😆 .Execute().ExecuteContext(ctx).

Comment on lines -51 to -53
// TODO: this test may need a stubbed out parent (root) command to get aliasing working
/*
func TestPostRunWorkspaceDeprecationMessage(t *testing.T) {
Copy link
Member Author

Choose a reason for hiding this comment

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

note: 🪓 Don't think we need this commented out test. We can add a fresh test when want to tackle that test coverage.

Copy link
Member

Choose a reason for hiding this comment

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

Ocuh! Commented codeblocks are often painful to revisit when the full context is in git histories 👾

Thanks for cleaning this up!

Copy link
Member Author

Choose a reason for hiding this comment

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

Totally agree! The git histories will keep the chronicle in case we ever want to revisit it. 📜

@mwbrooks mwbrooks marked this pull request as ready for review April 22, 2025 01:14
@mwbrooks mwbrooks requested a review from a team as a code owner April 22, 2025 01:14
@zimeg zimeg changed the title refactor: update CobraCommand.Execute to CobraCommand.ExecuteContext refactor: update CobraCommand.Execute to CobraCommand.ExecuteContext in tests Apr 22, 2025
Copy link
Member

@zimeg zimeg left a comment

Choose a reason for hiding this comment

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

LGTM! And an awesome follow up to #57 🤖 ✨

It's comforting to know that context has improved so much with this and prior PRs. I'm also unsettled at what might've been before!

Let's merge this soon once things feel right to you so we can develop with these changes. I look forward to this a lot 🎉

Comment on lines -51 to -53
// TODO: this test may need a stubbed out parent (root) command to get aliasing working
/*
func TestPostRunWorkspaceDeprecationMessage(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

Ocuh! Commented codeblocks are often painful to revisit when the full context is in git histories 👾

Thanks for cleaning this up!


func TestAppsListCommand(t *testing.T) {
// Create mocks
ctx := slackcontext.MockContext(t.Context())
Copy link
Member

Choose a reason for hiding this comment

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

😍 Love to see this more!

@mwbrooks mwbrooks merged commit 8073429 into main Apr 22, 2025
6 checks passed
@mwbrooks mwbrooks deleted the mbrooks-execute-references branch April 22, 2025 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code health M-T: Test improvements and anything that improves code health semver:patch Use on pull requests to describe the release version increment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants