Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Allow adding <properties> to <testcase> #247

Merged
merged 2 commits into from Apr 15, 2023

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

README.md Outdated Show resolved Hide resolved
@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
18 checks passed
@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

This has now been published in jest-junit v16 https://github.com/jest-community/jest-junit/releases/tag/v16.0.0

trevor-scheer pushed a commit to apollographql/apollo-server that referenced this pull request 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) -
[jest-community/jest-junit#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>
mergify bot pushed a commit to kinguru-io/kinguru-monorepo that referenced this pull request Dec 19, 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://developer.mend.io/api/mc/badges/age/npm/jest-junit/16.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/jest-junit/16.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/jest-junit/15.0.0/16.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/jest-junit/15.0.0/16.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>jest-community/jest-junit (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) - [jest-community/jest-junit#247

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

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

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

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

---

 - [ ] 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://developer.mend.io/github/kinguru-io/kinguru-monorepo).
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