Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: split specs based on timings from a JSON file #125

Merged
merged 3 commits into from
Oct 13, 2023
Merged

Conversation

bahmutov
Copy link
Owner

@bahmutov bahmutov commented Oct 13, 2023

Split specs based on timings

If you know the spec timings, you can create a JSON file and pass the timings to this plugin. The list of specs will be split into N machines to make the total durations for each machine approximately equal. You can see an example timings.json file:

{
  "durations": [
    {
      "spec": "cypress/e2e/chunks.cy.js",
      "duration": 300
    },
    {
      "spec": "cypress/e2e/spec-a.cy.js",
      "duration": 10050
    },
    ...
  ]
}

You can pass the JSON filename via SPLIT_FILE environment variable or Cypressenv variable.

# split all specs across 3 machines using known spec timings
# loaded from "timings.json" file
$ SPLIT_FILE=timings.json SPLIT=3 npx cypress run

# the equivalent syntax using Cypress --env argument
$ npx cypress run --env split=3,splitFile=timings.json

For specs not in the timings file, it will use average duration of the known specs.

@bahmutov bahmutov changed the title start work on splitting specs based on timings feat: split specs based on timings from a JSON file Oct 13, 2023
@bahmutov bahmutov marked this pull request as ready for review October 13, 2023 13:10
@bahmutov bahmutov merged commit 7532fe8 into main Oct 13, 2023
25 checks passed
@github-actions
Copy link

🎉 This PR is included in version 1.7.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Split based on running time
1 participant