npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cypress-kraken

v0.6.0

Published

A tool to run cypress tests in parallel

Downloads

16

Readme

cypress-kraken

A tool to run cypress tests in parallel

Features

  • Running cypress tests in parallel
  • Specify a maximum amount of tests to run per worker
  • Bail if one test has failed

Installation

$  yarn add -D cypress-kraken

or:

$  npm i -D cypress-kraken

Usage

Example on how to run the tool with minimal options:

$  yarn cypress-kraken -c "yarn cy:run"

For CI env it may be necessary to run Xvfb before cypress:

$  Xvfb :99 &
$  export DISPLAY=:99
$  yarn cypress-kraken -c "yarn cy:run"
$  pkill Xvfb

Ref: https://docs.cypress.io/guides/guides/continuous-integration.html#Xvfb

CLI Options

-c, --cmd

Cypress command to execute. It could be anything you want, and it could even have args. Defaults to yarn cypress run.

Samples: yarn cy:run / npm run cypress:run / yarn cy:run --config baseUrl=http://localhost:3000

-w, --workers

Specifies the number of workers the worker-pool will spawn for running tests. Defaults to the number of the cores available on your machine divide by 2.

--integrationFolder

Path to folder containing integration test files. Defaults to cypress/integration.

--retries

Number of times that failed tests should be retry, before considere them failed. Defaults to 2.

--testFiles

A String or Array of glob patterns of the test files to load. Defaults to **/*.*.

--testPathPattern

A regexp pattern string that is matched against all tests paths before executing the test. On Windows, you will need to use / as a path separator or escape as \\.

--maxConcurrency

Prevents Jest from executing more than the specified amount of tests at the same time. Defaults to 5.

-b, --bail

Exit the test suite immediately upon 1 failing test suite Defaults to false.

Troubleshooting

  • Xvfb exited with a non zero exit code. There was a problem spawning Xvfb.
Error: (EE)
Fatal server error:
(EE) Server is already active for display 99
If this server is no longer running, remove /tmp/.X99-lock
and start again.
(EE)

Solution:

When running on Linux, Cypress needs an X11 server; otherwise it spawns its own X11 server during the test run. When running several Cypress instances in parallel, the spawning of multiple X11 servers at once can cause problems for some of them. In this case, you can separately start a single X11 server and pass the server’s address to each Cypress instance using DISPLAY variable.

First, spawn the X11 server in the background at some port, for example :99. If you have installed xvfb on Linux or if you are using one of our Docker images from cypress-docker-images, the tools below should be available.

$  Xvfb :99 &

Second, set the X11 address in an environment variable

$  export DISPLAY=:99

Start Cypress as usual

$  yarn cypress-kraken -c "yarn cy:run"

After all tests across all Cypress instances finish, kill the Xvfb background process using pkill

$  pkill Xvfb

In certain Linux environments, you may experience connection errors with your X11 server. In this case, you may need to start Xvfb with the following command:

$  Xvfb -screen 0 1024x768x24 :99 &

Cypress internally passes these Xvfb arguments, but if you are spawning your own Xvfb, you would need to pass these arguments. This is necessary to avoid using 8-bit color depth with Xvfb, which will prevent Chrome or Electron from crashing.

$  xvfb-run -a yarn cypress:run

Ref: https://docs.cypress.io/guides/guides/continuous-integration.html#Xvfb

Releasing/Publishing

$  yarn version --minor
$  git push --follow-tags
$  npm publish

Todos

  • try using the module api
  • analize results at least from last ran, and sort them by time, and exec the ones that take the most in parallel with those that dont. a lot could even be empty, so all of those could be run together at once. basically pick smartly the specs to run

// yarn ${script} --reporter-options reportDir=cypress/results/${currentTime} -s ${tests.join(',')},

// "mocha": "^7.2.0", // "mochawesome": "^6.1.1",

// "reporter": "mochawesome", // "reporterOptions": { // "reportDir": "cypress/results", // "overwrite": false, // "html": false, // "json": true, // "toConsole": false // },