Registry / testing / cypress-circleci-reporter

cypress-circleci-reporter

JSON →
library0.5.0jsnpmunverified

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.

npm install cypress-circleci-reporter
INSTALL
IMPORT
SIG · CYPRESS-CIRCLECI-R
C
cypress-circleci-reporter
testingjavascriptv0.5.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Reporter Configuration String
module.exports = defineConfig({ e2e: { reporter: 'cypress-circleci-reporter', reporterOptions: { resultsDir: './test_results/cypress', resultFileName: 'cypress-[hash].xml' } } });
import { CypressCircleciReporter } from 'cypress-circleci-reporter';
The reporter is primarily configured as a string literal in `cypress.config.js` or `cypress.json`.
CLI Reporter Flag
cypress run --reporter cypress-circleci-reporter --reporter-options "resultsDir=./results/cypress,resultFileName=report-[hash].xml"
cypress run --reporter require('cypress-circleci-reporter')
When running Cypress via the command line, the reporter is specified using the `--reporter` flag. Reporter options are passed via `--reporter-options` as a comma-separated string.
ReporterOptions (TypeScript Type)
import { ReporterOptions } from 'cypress-circleci-reporter';
import ReporterOptions from 'cypress-circleci-reporter';
For TypeScript projects, the `ReporterOptions` interface can be imported to type custom configuration objects.

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
Debug
Known issues
breakingVersion 0.2.0 moved `mocha` from direct dependency to a peer dependency. This means `mocha` must now be explicitly installed in your project.
fix
Ensure `mocha` is installed as a dev dependency: `npm install mocha --save-dev` or `yarn add mocha --dev`.
affects: >=0.2.0
gotchaThe `resultFileName` reporter option MUST include the `[hash]` placeholder. This is crucial for generating unique report files when Cypress runs multiple spec files, especially in parallel environments, as each spec is processed separately. Without it, reports might overwrite each other.
fix
Always use `resultFileName: 'your-filename-[hash].xml'` (or similar) in your reporter options.
affects: >=0.1.0
gotchaThis reporter is designed for Cypress 3.8.3 or newer. Using older Cypress versions may lead to unexpected behavior or incompatibilities.
fix
Upgrade Cypress to version 3.8.3 or newer to ensure full compatibility.
affects: <3.8.3
gotchaEffective test parallelization relies on CircleCI's `circleci tests glob` and `circleci tests split --split-by=timings` commands. Incorrect usage or omission of these commands will prevent the reporter from aiding in optimized test distribution.
fix
Refer to the CircleCI documentation and the reporter's README for correct `command` syntax in your `config.yml`.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'mocha'
The `mocha` package is a peer dependency but was not installed in your project.
fix
Run `npm install mocha --save-dev` or `yarn add mocha --dev` to install the `mocha` test framework.
Error: Reporter "cypress-circleci-reporter" not found.
The reporter package is either not installed, misspelled in the configuration, or Cypress cannot resolve its path.
fix
Verify the package name is correctly spelled in your `cypress.config.js` or CLI command, and ensure `npm install cypress-circleci-reporter` was run successfully.
Invalid reporter option 'resultFileName': Must include '[hash]' placeholder.
The `resultFileName` option was provided without the mandatory `[hash]` string, which is required for generating unique report filenames.
fix
Modify your `reporterOptions` to include `resultFileName: 'my-report-[hash].xml'` (or similar) to ensure unique filenames.
Upgrade
Version history
0.5.0latest on npm
Audit
Dependencies
mocharequiredPeer dependency required by the reporter for its underlying functionality.
Agent activity
4 hits · last 30 days
node
4
Resources
cypress-circleci-reporter — npm install cypress-circleci-reporter · libregistry