jest-community / jest-junit

A Jest reporter that creates compatible junit xml files
Apache License 2.0
483 stars 109 forks source link

Feature Request: Allow adding custom properties to `<testcase>` #246

Closed eps1lon closed 1 year ago

eps1lon commented 1 year ago

Similar to custom <properties> in <testsuite>, this would allow adding properties to <testcase>. This would allow adding metadata to individual tests in DataDog (see https://docs.datadoghq.com/continuous_integration/tests/junit_upload/?tab=jenkins#providing-metadata-through-property-elements).

The main motivation is adding the number of test invocations (see https://github.com/jest-community/jest-junit/issues/157).

I understand that <properties> inside <testcase> would violate standard JUnit XSD but seems like this package is open to adding non-standard XML (e.g. https://github.com/jest-community/jest-junit/issues/228).

I already have a patch locally that we're using at Klarna and will propose it as a PR once we've tested it internally.

palmerj3 commented 1 year ago

Nice!

I'll happily review any PRs I see. So long as non-standard XML is gated behind a configuration option I'm fine with it.

eps1lon commented 1 year ago

@palmerj3 Opened https://github.com/jest-community/jest-junit/pull/247 which needs approval to run CI.