From c07ff3ef2706a210fea5e7124487dae913cf4122 Mon Sep 17 00:00:00 2001 From: Joshua Weber Date: Mon, 2 May 2022 21:19:55 +0200 Subject: [PATCH] :technologist: Adds report group type property --- packages/@aws-cdk/aws-codebuild/lib/report-group.ts | 12 +++++++++++- .../@aws-cdk/aws-codebuild/test/report-group.test.ts | 12 ++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/packages/@aws-cdk/aws-codebuild/lib/report-group.ts b/packages/@aws-cdk/aws-codebuild/lib/report-group.ts index 6dfaa34752d0c..d0f9d7bce158b 100644 --- a/packages/@aws-cdk/aws-codebuild/lib/report-group.ts +++ b/packages/@aws-cdk/aws-codebuild/lib/report-group.ts @@ -93,6 +93,16 @@ export interface ReportGroupProps { * @default RemovalPolicy.RETAIN */ readonly removalPolicy?: cdk.RemovalPolicy; + + /** + * The type of report group. This can be one of the following values: + * + * - **TEST** - The report group contains test reports. + * - **CODE_COVERAGE** - The report group contains code coverage reports. + * + * @default - TEST + */ + readonly type?: 'TEST' | 'CODE_COVERAGE' } /** @@ -125,7 +135,7 @@ export class ReportGroup extends ReportGroupBase { }); const resource = new CfnReportGroup(this, 'Resource', { - type: 'TEST', + type: props.type ? props.type : 'TEST', exportConfig: { exportConfigType: props.exportBucket ? 'S3' : 'NO_EXPORT', s3Destination: props.exportBucket diff --git a/packages/@aws-cdk/aws-codebuild/test/report-group.test.ts b/packages/@aws-cdk/aws-codebuild/test/report-group.test.ts index 6e653d891f3fb..eb28befe10b95 100644 --- a/packages/@aws-cdk/aws-codebuild/test/report-group.test.ts +++ b/packages/@aws-cdk/aws-codebuild/test/report-group.test.ts @@ -142,4 +142,16 @@ describe('Test Reports Groups', () => { "UpdateReplacePolicy": "Delete", }); }); + + test('can be created with type=CODE_COVERAGE', () => { + const stack = new cdk.Stack(); + + new codebuild.ReportGroup(stack, 'ReportGroup', { + type: 'CODE_COVERAGE', + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::ReportGroup', { + "Type": "CODE_COVERAGE", + }); + }); });