0.1.0 • Published 4 years ago
@split-tests/cypress v0.1.0
Split Tests in Cypress
Splits test files in Cypress and ensures all parallel jobs finish work at a similar time.
Before
| Job | Time | |
|---|---|---|
| =========================== | 1 | 46 minutes |
| ======== | 2 | 13 minutes |
| ============ | 3 | 19 minutes |
After
| Job | Time | |
|---|---|---|
| ============= | 1 | 26 minutes |
| ============= | 2 | 26 minutes |
| ============= | 3 | 26 minutes |
Setup
Install @split-tests/cypress package:
npm install --save-dev @split-tests/cypress
yarn add -D @split-tests/cypressIn 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 jestCYPRESS_JOBS_TOTAL- total number of jobsCYPRESS_JOBS_INDEX- index number of the job (starts with 0)