Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
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: 1 addition & 1 deletion packages/aws-cdk/lib/cdk-toolkit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ export class CdkToolkit {

// not outputting template to stdout, let's explain things to the user a little bit...
success(`Successfully synthesized to ${chalk.blue(path.resolve(stacks.assembly.directory))}`);
print(`Supply a stack id (${stacks.stackArtifacts.map(s => chalk.green(s.id)).join(', ')}) to display its template.`);
print(`Supply a stack id (${stacks.stackArtifacts.map(s => chalk.green(s.hierarchicalId)).join(', ')}) to display its template.`);

return undefined;
}
Expand Down
12 changes: 10 additions & 2 deletions packages/aws-cdk/test/cdk-toolkit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ import { instanceMockFrom, MockCloudExecutable, TestStackArtifact } from './util

let cloudExecutable: MockCloudExecutable;
let bootstrapper: jest.Mocked<Bootstrapper>;
let stderrMock: jest.SpyInstance;
beforeEach(() => {
jest.resetAllMocks();

Expand All @@ -86,6 +87,7 @@ beforeEach(() => {
}],
});

stderrMock = jest.spyOn(process.stderr, 'write').mockImplementation(() => { return true; });
});

function defaultToolkitSetup() {
Expand All @@ -105,9 +107,7 @@ describe('readCurrentTemplate', () => {
let template: any;
let mockForEnvironment = jest.fn();
let mockCloudExecutable: MockCloudExecutable;
let stderrMock: jest.SpyInstance;
beforeEach(() => {
stderrMock = jest.spyOn(process.stderr, 'write').mockImplementation(() => { return true; });

template = {
Resources: {
Expand Down Expand Up @@ -677,6 +677,13 @@ describe('watch', () => {
});

describe('synth', () => {
test('successful synth outputs hierarchical stack ids', async () => {
const toolkit = defaultToolkitSetup();
await toolkit.synth([], false, false);

expect(stderrMock.mock.calls[1][0]).toMatch('Test-Stack-A-Display-Name, Test-Stack-B');
});

test('with no stdout option', async () => {
// GIVE
const toolkit = defaultToolkitSetup();
Expand Down Expand Up @@ -787,6 +794,7 @@ class MockStack {
},
],
},
displayName: 'Test-Stack-A-Display-Name',
};
public static readonly MOCK_STACK_B: TestStackArtifact = {
stackName: 'Test-Stack-B',
Expand Down