feat(cli): add support for JUnit reporter (#4189)

This commit is contained in:
James George
2024-07-26 10:26:58 -07:00
committed by GitHub
parent ecf0901491
commit 5f96cda5e2
15 changed files with 1200 additions and 67 deletions

View File

@@ -65,6 +65,10 @@ program
"personal access token to access collections/environments from a workspace"
)
.option("--server <server_url>", "server URL for SH instance")
.option(
"--reporter-junit [path]",
"generate JUnit report optionally specifying the path"
)
.allowExcessArguments(false)
.allowUnknownOption(false)
.description("running hoppscotch collection.json file")
@@ -74,7 +78,18 @@ program
"https://docs.hoppscotch.io/documentation/clients/cli/overview#commands"
)}`
)
.action(async (pathOrId, options) => await test(pathOrId, options)());
.action(async (pathOrId, options) => {
const overrides: Record<string, unknown> = {};
// Choose `hopp-junit-report.xml` as the default value if `reporter-junit` flag is supplied without a value
if (options.reporterJunit === true) {
overrides.reporterJunit = "hopp-junit-report.xml";
}
const effectiveOptions = { ...options, ...overrides };
await test(pathOrId, effectiveOptions)();
});
export const cli = async (args: string[]) => {
try {