Cypress CircleCI Reporter

0.5.0 · active · verified Tue Apr 21

cypress-circleci-reporter is a specialized test reporter for Cypress, designed to integrate seamlessly with CircleCI's test parallelization features. Based on `mocha-junit-reporter`, it generates JUnit XML reports and leverages test timing data to optimize test distribution across parallel CircleCI containers. This allows for faster feedback cycles in CI/CD pipelines. The current stable version is 0.5.0, with releases occurring intermittently but actively since 2020. Key differentiators include its focus on enhancing CircleCI's built-in parallelization, the ability to specify report output directories and filenames with hash-based uniqueness, and a `consoleOutput` option for real-time test status in the terminal. It requires Cypress 3.8.3 or newer and `mocha` as a peer dependency.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to configure `cypress-circleci-reporter` within `cypress.config.ts` and shows a typical CircleCI `config.yml` setup for parallel test execution.

import { defineConfig } from 'cypress';

module.exports = defineConfig({
  e2e: {
    // Configure the reporter and its options
    reporter: 'cypress-circleci-reporter',
    reporterOptions: {
      project: process.env.CYPRESS_PROJECT_NAME ?? undefined, // Optional: if you use Cypress' project parameter
      resultsDir: './test_results/cypress', // Directory for JUnit XML reports
      resultFileName: 'cypress-[hash].xml', // Filename for each report, [hash] is crucial for uniqueness
      consoleOutput: true // Enable console output for test results
    },
    // Implement node event listeners if needed (e.g., for code coverage, though not direct reporter usage)
    setupNodeEvents(on, config) {
      // This is where you might include other Cypress plugins if necessary
      // For cypress-circleci-reporter, primary setup is through the 'reporter' key above.
      return config;
    }
  }
});

// In your package.json scripts:
// "scripts": {
//   "cypress:ci": "yarn cypress run --spec \"$(circleci tests glob \"./cypress/e2e/**/*.cy.js\" | circleci tests split --split-by=timings | paste -sd \",\" -)\" --reporter cypress-circleci-reporter"
// }

// Example CircleCI config snippet:
// run_cypress_tests:
//   parallelism: 3
//   steps:
//     - run:
//         name: Run cypress tests
//         command: |
//           yarn cypress run --spec "$(circleci tests glob "./cypress/e2e/**/*.cy.js" | circleci tests split --split-by=timings | paste -sd "," -)" \
//             --reporter cypress-circleci-reporter \
//             --reporter-options "resultsDir=./test_results/cypress,resultFileName=cypress-[hash].xml,consoleOutput=true"
//     - store_test_results:
//         path: test_results
//     - store_artifacts:
//         path: test_results

view raw JSON →