diff --git a/packages/aws-cdk/lib/cdk-toolkit.ts b/packages/aws-cdk/lib/cdk-toolkit.ts index 70d7650f58f7b..e5ff7cc642af3 100644 --- a/packages/aws-cdk/lib/cdk-toolkit.ts +++ b/packages/aws-cdk/lib/cdk-toolkit.ts @@ -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; } diff --git a/packages/aws-cdk/test/diff.test.ts b/packages/aws-cdk/test/diff.test.ts index 128c933dad245..ad8202a64db63 100644 --- a/packages/aws-cdk/test/diff.test.ts +++ b/packages/aws-cdk/test/diff.test.ts @@ -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); }); @@ -96,6 +97,7 @@ describe('non-nested stacks', () => { }); // THEN + expect(buffer.data.trim()).toContain('✨ Number of stacks with differences: 1'); expect(exitCode).toBe(1); }); @@ -121,6 +123,7 @@ describe('non-nested stacks', () => { }); // THEN + expect(buffer.data.trim()).toContain('✨ Number of stacks with differences: 1'); expect(exitCode).toBe(1); }); @@ -255,7 +258,10 @@ Resources └─ [~] .Properties: └─ [~] .Prop: ├─ [-] old-value - └─ [+] new-value`); + └─ [+] new-value + + +✨ Number of stacks with differences: 3`); expect(exitCode).toBe(0); });