Skip to content
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

feat(cli): add diff message on the number of stacks with differences #26297

Merged
merged 3 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/aws-cdk/lib/cdk-toolkit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ export class CdkToolkit {
}
}

stream.write(format('\n✨ Number of stacks with differences: %s\n', diffs));

return diffs && options.fail ? 1 : 0;
}

Expand Down
8 changes: 7 additions & 1 deletion packages/aws-cdk/test/diff.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ describe('non-nested stacks', () => {
expect(plainTextOutput).toContain('Stack A');
expect(plainTextOutput).toContain('Stack B');

expect(buffer.data.trim()).toContain('✨ Number of stacks with differences: 2');
expect(exitCode).toBe(0);
});

Expand All @@ -96,6 +97,7 @@ describe('non-nested stacks', () => {
});

// THEN
expect(buffer.data.trim()).toContain('✨ Number of stacks with differences: 1');
expect(exitCode).toBe(1);
});

Expand All @@ -121,6 +123,7 @@ describe('non-nested stacks', () => {
});

// THEN
expect(buffer.data.trim()).toContain('✨ Number of stacks with differences: 1');
expect(exitCode).toBe(1);
});

Expand Down Expand Up @@ -255,7 +258,10 @@ Resources
└─ [~] .Properties:
└─ [~] .Prop:
├─ [-] old-value
└─ [+] new-value`);
└─ [+] new-value


✨ Number of stacks with differences: 3`);

expect(exitCode).toBe(0);
});
Expand Down
Loading