0.1.0 • Published 3 years ago

@split-tests/cypress v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
3 years ago

Split Tests in Cypress

Splits test files in Cypress and ensures all parallel jobs finish work at a similar time.

Before

JobTime
===========================146 minutes
========213 minutes
============319 minutes

After

JobTime
=============126 minutes
=============226 minutes
=============326 minutes

Setup

Install @split-tests/cypress package:

npm install --save-dev @split-tests/cypress
yarn add -D @split-tests/cypress

In cypress/plugins/index.js:

const plugin = require("@split-tests/cypress");

module.exports = plugin;

Use JUnit to report run times of the tests (in cypress.json):

{
  "reporter": "junit",
  "reporterOptions": {
    "mochaFile": "reports/junit-[hash].xml"
  }
};

Usage

Jobs are calculated at run time:

$ CYPRESS_JOBS_TOTAL=3 CYPRESS_JOBS_INDEX=0 jest
  • CYPRESS_JOBS_TOTAL - total number of jobs
  • CYPRESS_JOBS_INDEX - index number of the job (starts with 0)