Skip to content

Conversation

@eps1lon
Copy link
Contributor

@eps1lon eps1lon commented Mar 22, 2023

Closes #246

Create a file in your project root directory named junitTestCaseProperties.js:

module.exports = (testResult) => {
  return {
    "dd_tags[test.invocations]": testResult.invocations,
  };
};

Will render

<testsuites name="jest tests">
  <testsuite name="addition" tests="1" errors="0" failures="0" skipped="0" timestamp="2017-07-13T09:42:28" time="0.161">
    <testcase classname="addition positive numbers should add up" name="addition positive numbers should add up" time="0.004">
      <properties>
        <property name="dd_tags[test.invocations]" value="1" />
      </properties>
    </testcase>
  </testsuite>
</testsuites>

WARNING: Properties for testcases is not following standard JUnit XML schema.
However, other consumers may support properties for testcases like DataDog metadata through <property> elements

@eps1lon eps1lon marked this pull request as ready for review March 22, 2023 16:29
Copy link

@AfefZn AfefZn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works correctly!

@AfefZn
Copy link

AfefZn commented Apr 10, 2023

Hello @palmerj3, Could You please review this pull request?

@AfefZn
Copy link

AfefZn commented Apr 12, 2023

@SimenB, Could You please review this pull request?

@palmerj3 palmerj3 merged commit c753b42 into jest-community:master Apr 15, 2023
@palmerj3
Copy link
Collaborator

Looks great!

Sorry for the delay in reviewing. Work has been very busy lately.

@eps1lon eps1lon deleted the feat/testcase-properties branch April 15, 2023 14:58
@palmerj3
Copy link
Collaborator

trevor-scheer referenced this pull request in apollographql/apollo-server Apr 17, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [jest-junit](https://togithub.com/jest-community/jest-junit) |
[`15.0.0` ->
`16.0.0`](https://renovatebot.com/diffs/npm/jest-junit/15.0.0/16.0.0) |
[![age](https://badges.renovateapi.com/packages/npm/jest-junit/16.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/npm/jest-junit/16.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/npm/jest-junit/16.0.0/compatibility-slim/15.0.0)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/npm/jest-junit/16.0.0/confidence-slim/15.0.0)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>jest-community/jest-junit</summary>

###
[`v16.0.0`](https://togithub.com/jest-community/jest-junit/releases/tag/v16.0.0)

[Compare
Source](https://togithub.com/jest-community/jest-junit/compare/v15.0.0...v16.0.0)

Allow adding properties to testcases in junit output by
[@&#8203;eps1lon](https://togithub.com/eps1lon) -
[https://github.com/jest-community/jest-junit/pull/247](https://togithub.com/jest-community/jest-junit/pull/247)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "every weekend" in timezone
America/Los_Angeles, Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/apollographql/apollo-server).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS40MC4wIiwidXBkYXRlZEluVmVyIjoiMzUuNDAuMCJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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.

Feature Request: Allow adding custom properties to <testcase>

3 participants