michaelleeallen / mocha-junit-reporter

A JUnit XML reporter for mocha.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Package name showing as “root” in Jenkin pipeline with cypress junit reporter

sabf81 opened this issue · comments

commented

We are using Cypress with JUnit Reporter.
Out test-suite runs in Jenkin. But in Jenkin's Junit test result the package name always shows root.

How can I change it from root to any other name?

root-package-name

Config of reporter:
reporter-config json

Test Example:
 test spec ts

Hi currently there isn't an option for that, I had the same issue :/
Created PR to fix this #138

For now, you can use this patched reporter directly if you don't want to wait.
For example, I have this reporter in cypress/reporters/jenkins.js
and here is part of my cypress.json:

  "reporter": "cypress/reporters/jenkins.js",
  "reporterOptions": {
    "mochaFile": "cypress/reports/cypress-report-[hash].xml",
    "jenkinsMode": true,
    "jenkinsClassnamePrefix": "E2E Tests",
    "toConsole": true
  },

Released patched version for those who are impatient as I am :)
https://www.npmjs.com/package/@prnsml/mocha-junit-reporter

  1. npm install @prnsml/mocha-junit-reporter@2.1.1 --save-dev
  2. Set reporter to @prnsml/mocha-junit-reporter
  3. Add jenkinsClassnamePrefix with your prefered prefix to reporterOptions
  4. 😎
commented

@michaelleeallen can please accept the PR #138 to fix it?
Thanks.

commented

Bump :) Love this project and that it caters to Jenkins, and this would be a nice QoL improvement.

commented

Bump too : this would make it way easier to easily split different test levels / sources / suites in Jenkins :)

#138 was merged about a month age, this should be available now