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

cy2

v4.0.9

Published

Integrate Cypress with alternative cloud services like Sorry Cypress or Currents

Downloads

740,138

Readme

cy2

Integrate Cypress with alternative cloud services like Sorry Cypress or Currents


Currents.dev - is a hosted cloud service used to run millions of Cypress tests without breaking the bank. This is an enhanced version of Sorry Cypress with better security, performance, analytics, integrations and support.

Sorry Cypress - is an open-source, free alternative to Cypress Cloud that unlocks unlimited parallelization, test recordings, and integration with GitHub, Slack and more.


npm downloads

cy2 integrates cypress with alternative orchestration services like Sorry Cypress or Currents.


Dec 2023 Update

If you are seeing Error: certificate has expired, please upgrade to version 4.0.8+.

March 2023 Update

⭐️ Cypress 12.6.0+ users, please use https://github.com/currents-dev/cypress-cloud if you are seeing Cypress does not support recording test results to this third party service error ⭐️


Changelog | License GPL-3.0+

Install

npm install cy2

CLI Usage

Set the environment variable CYPRESS_API_URL and run cy2. The command passes down all the CLI flags to cypress runner as-is.

# use `http://localhost:1234` as orchestration cloud service
CYPRESS_API_URL="http://localhost:1234/" cy2 run --parallel --record --key somekey --ci-build-id hello-cypress

Example usage with sorry-cypress. The URL should point to director service.

CYPRESS_API_URL="https://sorry-cypress-demo-director.herokuapp.com" cy2 run  --parallel --record --key somekey --ci-build-id hello-cypress

API

run

Run Cypress via its Module API

run(apiUrl: string, config: CypressCommandLine.CypressRunOptions): Promise<CypressCommandLine.CypressRunResult | CypressCommandLine.CypressFailedRunResult>

Example:

import { run } from 'cy2';

const results = await run('https://sorry-cypress.company.net', {
  reporter: 'junit',
  browser: 'chrome',
  config: {
    baseUrl: 'http://localhost:8080',
    video: true,
  },
});

spawn

Spawn Cypress as a child process and inherit all the flags and environment variables. It invokes process.exit with the child process' exit code.

spawn(apiUrl: string): Promise<void>

Example:

import { spawn } from 'cy2';

await spawn(process.env.CYPRESS_API_URL);

Breaking Changes

Version 4

  • patch method was deprecated. Use run instead.

Version 3

  • Starting version 3+, the API methods run and patch rely on process.env.CYPRESS_API_URL instead of accepting an argument. That's because of a new patching method that doesn't permanently change cypress configuration after invoking cy2.

patch [deprecated in 4+]

Deprecated due to the changes in cypress introduced in version 12+.

Change cypress configuration without running it.

patch(cypressPackageEntryPath: string) => Promise<void>

⚠️ Make sure to set process.env.CYPRESS_API_URL before invoking patch

Example:

import { patch } from 'cy2';
import cypress from 'cypress';

process.env.CYPRESS_API_URL = 'https://dashboard.service.url';

async function main() {
  // optional - provide cypress package main entry point location
  await patch(require.resolve('cypress'));

  cypress
    .run({
      // the path is relative to the current working directory
      spec: './cypress/e2e/examples/actions.cy.js',
    })
    .then((results) => {
      console.log(results);
    })
    .catch((err) => {
      console.error(err);
    });
}
main().catch((error) => {
  console.error(error);
  process.exit(1);
});