refactor(utils): route output through IOStreams and drop dead helpers#34
Merged
Conversation
displayIssueDetails now writes via an injected io parameter so tests and non-TTY callers no longer go through console.log directly. Removed success/error/warning/info and displayCommentDetails which were unused and duplicated existing IOStreams methods.
|
🎉 This PR is included in version 2.8.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
Summary
displayIssueDetailsnow takes anioparameter (IOStreams) instead of writing toconsole.log, so output is testable and consistent with the rest of the codebase.success/error/warning/infofromlib/utils.js—IOStreams.printSuccess/printError/printWarning/printInfoalready provide the same functionality and these were never imported anywhere.displayCommentDetails(no callers).console.*calls inlib/utils.js(was 26).Why
lib/utils.jswas bypassing the IOStreams abstraction in 26 places. That made the output untestable and broke the layering — the rest of the CLI already routes everything throughfactory.getIOStreams(). Three of the offending exports were also dead code, so this cleans up the public surface area at the same time.Test plan
npm test— 251 tests pass (+2 new fordisplayIssueDetails)npm run lint— cleanjira issue get <KEY>renders the same output (relies onio.printlninstead ofconsole.log)