Cypress Utilities CLI

3.0.0 · active · verified Wed Apr 22

Cypress Utils is a command-line interface (CLI) tool designed to enhance the execution of Cypress tests by providing capabilities for parallelization and stress-testing. Its current stable version is 3.0.0, which introduced support for Cypress v10 and updated CLI options to mirror Cypress's own changes. The tool primarily aims to reduce local test run times by allowing multiple Cypress instances to run concurrently and helps identify flaky tests by executing them repeatedly under configurable conditions. It does not follow a fixed release cadence but typically updates to align with major Cypress version releases, ensuring compatibility. Key differentiators include its focus on simplifying parallel execution and stress testing directly from the command line, abstracting away the complexities of managing multiple Cypress processes manually.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates `cypress-utils` installation and its usage via `package.json` scripts for parallel execution and stress-testing of Cypress specs, including example spec and direct `npx` commands.

{
  "name": "my-cypress-project",
  "version": "1.0.0",
  "description": "Example project using cypress-utils",
  "devDependencies": {
    "cypress": "^10.0.0",
    "cypress-utils": "^3.0.0"
  },
  "scripts": {
    "test": "echo \"No script specified\" && exit 1",
    "test:parallel": "cypress-utils run-parallel --threads 2",
    "test:stress": "cypress-utils stress-test cypress/e2e/flaky-spec.cy.js --trialCount 5"
  }
}

// 1. Install cypress-utils and Cypress (if not already installed)
// npm install --save-dev cypress cypress-utils

// 2. Create an example Cypress spec file, e.g., cypress/e2e/flaky-spec.cy.js:
// describe('Flaky Test', () => {
//   it('should sometimes pass and sometimes fail', () => {
//     const randomNumber = Math.random();
//     if (randomNumber < 0.5) {
//       cy.log('Test passed!');
//       expect(true).to.be.true;
//     } else {
//       cy.log('Test failed intentionally!');
//       expect(false).to.be.true;
//     }
//   });
// });

// 3. To run tests in parallel (as defined in package.json):
// npm run test:parallel

// 4. To stress-test a specific spec file (as defined in package.json):
// npm run test:stress

// You can also run commands directly with npx:
// npx cypress-utils run-parallel cypress/e2e/another-spec.cy.js --threads 3
// npx cypress-utils stress-test cypress/e2e/login.cy.js --trialCount 20 --threads 4

view raw JSON →