Jaro
Jaro

Reputation: 3887

How to show test report generated by mocha in bamboo

I have node.js project and I'd like to run test cases written mocha (visionmedia.github.io/mocha/) in our bamboo (atlassian product), but mocha does not provide any reported for bamboo, ie. JUnit reporter.

I'm thinking about coverting xUnit to JUnit formart, but so far I've not found any solution for this.

Can any one advice?

Upvotes: 0

Views: 2072

Answers (2)

pscheit
pscheit

Reputation: 2981

use https://www.npmjs.com/package/mocha-bamboo-reporter there is a task "Mocha Test Parser" which is installed when you install the nodejs bamboo plugin.

Pickup the results written from the mocha-bamboo-reporter with this task in "final tasks" of your build stage

Upvotes: 0

Jaro
Jaro

Reputation: 3887

so far I fixed this by subunit combo:

mocha -R tap ./test/*.js > ./test-reports/result.tap

cd ./test-reports

cat ./result.tap | \
  tap2subunit | subunit2junitxml > result.junit && \
  xmllint --pretty 1 result.junit > result.junit.xml

Upvotes: 1

Related Questions