Skip to content

Instantly share code, notes, and snippets.

@vegaasen
Last active February 28, 2022 10:28
Show Gist options
  • Save vegaasen/2fc27a87f621a9ce2118bf75f9080558 to your computer and use it in GitHub Desktop.
Save vegaasen/2fc27a87f621a9ce2118bf75f9080558 to your computer and use it in GitHub Desktop.
Cypress tips & tricks (configuration)

Cypress

This is just my ramblings regarding Cypress and ideas/tips/tricks that I've encountered during my days with this amazing tool 😁.

Parallelity?

Want parallel execution of your Cypress installation without using the default --parallel option? See below!

1. Add dependency for cypress-parallel

npm install -D cypress-parallel

2. Add mocka/junit dependency

npm install -D mocha-junit-reporter

3. Configure runnable

In package.json

  "scripts": {
    "start": "cypress open",
    "test": "cypress run",
    "test-speedy": "cypress-parallel -s test -t 4 --reporter mocha-junit-reporter --reporterOptions \"mochaFile=tests/test-output-[hash].xml,toConsole=true,attachments=true\""
  },

Here we're using:

  • 4 threads
  • trigger test command (found in the scripts-section)
  • sets reporter to mocha-junit-reporter
  • adds some configuration for the reporter
  1. Done ✅

You're done, and exeuction should now be happening in parallel!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment