Skip to content

Commit

Permalink
Merge pull request #3452 from snyk/chore/add-project-name-to-test-sum…
Browse files Browse the repository at this point in the history
…mary-cfg-2013

chore: Add project name to test summary [CFG-2013]
  • Loading branch information
ofekatr committed Jul 12, 2022
2 parents ec88c8d + aba9be1 commit e3fc9b9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/lib/formatters/iac-output/v2/test-summary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ function formatTestMetaSection(iacMeta: IacOutputMeta): string {
metaSectionProperties.push(['Organization', iacMeta.orgName]);
}

if (iacMeta.projectName) {
metaSectionProperties.push(['Project name', iacMeta.projectName]);
}

const metaSection = metaSectionProperties
.map(([key, value]) =>
rightPadWithSpaces(`${INDENT}${key}: ${value}`, PAD_LENGTH),
Expand Down
2 changes: 2 additions & 0 deletions test/jest/acceptance/iac/iac-output.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ describe('iac test output', () => {
'Test Summary' +
EOL.repeat(2) +
' Organization: test-org' +
EOL +
' Project name: fixtures' +
EOL.repeat(2) +
'✔ Files without issues: 0' +
EOL +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ describe('formatIacTestSummary', () => {
const result = formatIacTestSummary(testTestData);

// Assert
expect(result).toContain(`Organization: Shmulik.Kipod`);
expect(result).toContain(`Organization: Shmulik.Kipod
Project name: project-name`);
});

it('should include the counts section with the correct values', () => {
Expand Down

0 comments on commit e3fc9b9

Please sign in to comment.