Skip to content

fix(cli): improve no stacks found message in synth output #3864

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

nithishravindra
Copy link

@nithishravindra nithishravindra commented May 2, 2025

Related issue

Fixes #2793

Description

Updates the error message shown when no stacks are found during cdktf synth to be more descriptive. This helps users understand they need to define at least one TerraformStack in their CDKTF application

Checklist

  • I have updated the PR title to match CDKTF's style guide
  • I have run the linter on my code locally
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation if applicable
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works if applicable
  • New and existing unit tests pass locally with my changes

Copy link

hashicorp-cla-app bot commented May 2, 2025

CLA assistant check
All committers have signed the CLA.

@nithishravindra nithishravindra force-pushed the improve-synth-no-stack-message branch from 39b12d9 to 61671c1 Compare May 16, 2025 16:47
@nithishravindra nithishravindra marked this pull request as ready for review May 16, 2025 16:52
@nithishravindra nithishravindra requested a review from a team as a code owner May 16, 2025 16:52
@nithishravindra nithishravindra requested review from ansgarm and DanielMSchmidt and removed request for a team May 16, 2025 16:52
@nithishravindra nithishravindra marked this pull request as draft May 16, 2025 16:53
@nithishravindra nithishravindra marked this pull request as ready for review May 16, 2025 17:01
@nithishravindra nithishravindra marked this pull request as draft May 16, 2025 17:06
@nithishravindra nithishravindra force-pushed the improve-synth-no-stack-message branch from c5e46ac to 1d6779f Compare May 20, 2025 05:16
@nithishravindra nithishravindra marked this pull request as ready for review May 20, 2025 05:23
@nithishravindra nithishravindra force-pushed the improve-synth-no-stack-message branch from 8ce552f to 139b2c2 Compare May 20, 2025 05:25
@nithishravindra nithishravindra force-pushed the improve-synth-no-stack-message branch from fb853c7 to f1f73d0 Compare May 26, 2025 17:11
Copy link
Member

@ansgarm ansgarm left a comment

Choose a reason for hiding this comment

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

Looks good to me, @nithishravindra 👍

? `Generated Terraform code for the stacks: ${stacks
.map((s) => s.name)
.join(", ")}`
: "No stacks found in configuration."}
Copy link
Member

@ansgarm ansgarm Jun 11, 2025

Choose a reason for hiding this comment

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

I think I'd refer to a specific configuration (i.e. the one at hand) and therefore add a "the" to make that more specific. But that's mostly my personal choice, and I'd be open to skip this or get some feedback from a native speaker :)

Suggested change
: "No stacks found in configuration."}
: "No stacks found in the configuration."}

Copy link
Member

Choose a reason for hiding this comment

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

I think the existing one is slightly better, but also just a personal choice. Non-native speaker


test("SynthOutput", () => {
const { lastFrame } = render(<SynthOutput stacks={[]} />);
expect(stripAnsi(lastFrame())).toBe("No stacks found in configuration.");
Copy link
Member

Choose a reason for hiding this comment

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

(if we change the wording, this needs an update as well)

Suggested change
expect(stripAnsi(lastFrame())).toBe("No stacks found in configuration.");
expect(stripAnsi(lastFrame())).toBe("No stacks found in the configuration.");

Copy link
Member

@mutahhir mutahhir left a comment

Choose a reason for hiding this comment

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

Minor nits, but overall good to go! Thank you for adding tests for this too!

? `Generated Terraform code for the stacks: ${stacks
.map((s) => s.name)
.join(", ")}`
: "No stacks found in configuration."}
Copy link
Member

Choose a reason for hiding this comment

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

I think the existing one is slightly better, but also just a personal choice. Non-native speaker

test("SynthOutput", () => {
const { lastFrame } = render(<SynthOutput stacks={[]} />);
expect(stripAnsi(lastFrame())).toBe("No stacks found in configuration.");
{
Copy link
Member

Choose a reason for hiding this comment

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

I'd rather this be split into two tests. While it is completely fine, I'm personally not a big fan of restricting scope like this. That being said, if you want there to be just one test, you can use let instead of const. We do that a lot where we want to test a variety of small changes within the same test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CLI UX: Nicer output for cdktf synth if there are no stacks in an app
3 participants