Skip to main content

Cypress

In the steps below, we'll start with a project that has an existing Cypress test suite, and we'll add JUnit XML as an additional output format for the test suite.

  1. Update your CI workflow to output JUnit XML reports describing the test results.

Below we add the junit reporter when running the test suite, and we tell it to write the reports to the cypress/results/ directory at the root of the project.

    blocks:
- checkout
- sem-version node 12
- npm install
- - npx cypress run
+ - npx cypress run --reporter junit --reporter-options "mochaFile=cypress/results/results-[hash].xml"

This example project uses Semaphore for CI, so we're updating the CI workflow in .semaphore/semaphore.yml. If you're using a different CI service, apply this change wherever your CI script is defined (e.g., .circleci/config.yml for CircleCI, etc.).

  1. Commit this change to your repository.
git commit -am "Update CI to generate JUnit XML for test results"

The final result of these changes should resemble commit ff7c8a5 in the buildpulse-example-cypress repository.