Skip to content

fix(cli): diff always prints stack name #304

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 2, 2025
Merged

Conversation

kaizencc
Copy link
Contributor

@kaizencc kaizencc commented Apr 1, 2025

Fixes #302

In #264, we capture the output of the Formatter into a stream, and that is then converted to a string. This diff only gets printed if the diff isn't empty, but by some quirk formatStackDiff used to print the stack name outside of the stream, thus creating the (correct) behavior. #264 made sure that format doesn't print, so we need to make sure that the consumer of formatStackDiff prints the relevant info.

This PR makes sure that the stack name is returned as the formatted diff even if the actual diff is empty. We will print the right information when we print the formatted diff now.

I also made similar modifications to formatSecurityDiff, as we should move away from format methods printing anything at all.

BEFORE (cdk 2.1006.0):

Screenshot 2025-04-02 at 9 04 04 AM

AFTER (my local cdk):

Screenshot 2025-04-02 at 9 03 11 AM

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

Comment on lines +911 to +912
Stack UnChangedChild
There were no differences`);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this was missed in #264; it should have not been removed, and would have alerted us of the issue.

it also shows an additional thing that this PR fixes. previously, the comment There were no differences was printed separately from the diff (on console, it renders the same). now it is included in the formatted diff itself

@codecov-commenter
Copy link

codecov-commenter commented Apr 2, 2025

Codecov Report

Attention: Patch coverage is 85.71429% with 2 lines in your changes missing coverage. Please review.

Project coverage is 85.45%. Comparing base (445fd71) to head (ad302b9).

Files with missing lines Patch % Lines
...tmp-toolkit-helpers/src/api/diff/diff-formatter.ts 85.71% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #304      +/-   ##
==========================================
- Coverage   85.54%   85.45%   -0.10%     
==========================================
  Files         222      222              
  Lines       36926    36925       -1     
  Branches     4458     4445      -13     
==========================================
- Hits        31588    31553      -35     
- Misses       5248     5274      +26     
- Partials       90       98       +8     
Flag Coverage Δ
suite.unit 85.45% <85.71%> (-0.10%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: github-actions <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stack names missing in output
4 participants