Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 3 additions & 1 deletion packages/aws-cdk/lib/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ export enum Command {
METADATA = 'metadata',
INIT = 'init',
VERSION = 'version',
WATCH = 'watch',
}

const BUNDLING_COMMANDS = [
Command.DEPLOY,
Command.DIFF,
Command.SYNTH,
Command.SYNTHESIZE,
Command.WATCH,
];

export type Arguments = {
Expand Down Expand Up @@ -251,7 +253,7 @@ export class Settings {
// Determine bundling stacks
let bundlingStacks: string[];
if (BUNDLING_COMMANDS.includes(argv._[0])) {
// If we deploy, diff or synth a list of stacks exclusively we skip
// If we deploy, diff, synth or watch a list of stacks exclusively we skip
// bundling for all other stacks.
bundlingStacks = argv.exclusively
? argv.STACKS ?? ['*']
Expand Down
22 changes: 22 additions & 0 deletions packages/aws-cdk/test/settings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,16 @@ test('bundling stacks defaults to * for deploy', () => {
expect(settings.get(['bundlingStacks'])).toEqual(['*']);
});

test('bundling stacks defaults to * for watch', () => {
// GIVEN
const settings = Settings.fromCommandLineArguments({
_: [Command.WATCH],
});

// THEN
expect(settings.get(['bundlingStacks'])).toEqual(['*']);
});

test('bundling stacks with deploy exclusively', () => {
// GIVEN
const settings = Settings.fromCommandLineArguments({
Expand All @@ -112,6 +122,18 @@ test('bundling stacks with deploy exclusively', () => {
expect(settings.get(['bundlingStacks'])).toEqual(['cool-stack']);
});

test('bundling stacks with watch exclusively', () => {
// GIVEN
const settings = Settings.fromCommandLineArguments({
_: [Command.WATCH],
exclusively: true,
STACKS: ['cool-stack'],
});

// THEN
expect(settings.get(['bundlingStacks'])).toEqual(['cool-stack']);
});

test('should include outputs-file in settings', () => {
// GIVEN
const settings = Settings.fromCommandLineArguments({
Expand Down