Skip to content

Conversation

@joshfried-aws
Copy link
Contributor

@joshfried-aws joshfried-aws commented Jan 17, 2024

Issue #, if available:
#265

Description of changes:
This PR adds a new JUnit reporter. Users can create a junit report similar to how they specify structured json or yaml reports.

To reduce code duplication I did some refactoring in the structured reporter. Building the vector of RuleFile structs, and merging the data files with input params is done before delegating the mechanism of reporting (JUnit/JSON/YAML).

I implemented a mechanism to get all the failures for a clause, so we can properly output them according to the junit spec. I also decided to add constants for our error codes in an effort to standardize (0 is success, 5 is parse error, 19 is validation failure)

To generate a JUnit report add the following flags when running the CLI

-z -o junit -S none

or

--structured --output junit --show-summary none

Similarly to the JSON and YAML structured reports, show-summary must be set to none, and the --structured flag must be present. This is to prevent polluting the output with plaintext that would break any parser.

PLEASE NOTE
Unlike JSON and YAML reports, JUnit reports are only available when using the structured reporter. Attempting to use the junit reporter without specifying the structured flag will result in an error


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@joshfried-aws joshfried-aws merged commit 1619c0a into aws-cloudformation:main Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants