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
2 changes: 1 addition & 1 deletion packages/aws-cdk/lib/util/yargs-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function yargsNegativeAlias<T extends { [x in S | L]: boolean | undefined
* @returns true if the current process is running in a CI environment
*/
export function isCI(): boolean {
return process.env.CI !== undefined;
return process.env.CI !== undefined && process.env.CI !== 'false' && process.env.CI !== '0';
}

/**
Expand Down
14 changes: 14 additions & 0 deletions packages/aws-cdk/test/util/yargs-helpers.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { isCI } from '../../lib/util/yargs-helpers';

test.each([
['true', true],
['1', true],
['false', false],
['0', false],
// The following ones are unexpected but this is the legacy behavior we're preserving.
['banana', true],
['', true],
])('test parsing of falsey CI values: %p parses as %p', (envvar, ci) => {
process.env.CI = envvar;
expect(isCI()).toEqual(ci);
});
Loading