Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cy2

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cy2 - npm Package Compare versions

Comparing version 3.0.0-alpha.0 to 3.0.0-alpha.1

2

package.json
{
"name": "cy2",
"version": "3.0.0-alpha.0",
"version": "3.0.0-alpha.1",
"author": "Andrew Goldis",

@@ -5,0 +5,0 @@ "main": "./dist",

@@ -40,81 +40,17 @@ # cy2

When `CYPRESS_API_URL` is not set, it just uses the default API server `https://api.cypress.io`
⚠️ `CYPRESS_API_URL` is required
## API
### Patch Cypress
### Run Cypress with an injected module
```ts
/**
* Patch Cypress with a custom API URL.
*
* Tries to discover the location of `app.yml`
* and patch it with a custom URL.
*
* @param {string} apiURL - new API URL to use
* @param {string} [cypressConfigFilePath] - explicitly provide the path to Cypress app.yml and disable auto-discovery
*/
patch(apiURL: string, cypressConfigPath?: string) => Promise<void>
```
import { run } from 'cy2';
Example
```js
const { patch } = require("cy2");
async function main() {
await patch("https://sorry-cypress-demo-director.herokuapp.com");
}
main().catch(console.error);
run(`${__dirname}/injected.js`).catch((error) => {
console.error(error);
process.exit(1);
});
```
### Patch and run cypress
```ts
/**
* Run Cypress programmatically as a child process
*/
run(apiURL?: string = 'https://api.cypress.io/'), label?: string = 'cy2')=> Promise<void>
```
Example
```js
#!/usr/bin/env node
/* cmd.js */
const { run } = require("cy2");
async function main() {
await run("https://sorry-cypress-demo-director.herokuapp.com/", "myCMD");
}
main().catch(console.error);
/*
$ ./cmd.js --help
[myCMD] Running cypress with API URL: https://sorry-cypress-demo-director.herokuapp.com/
Usage: cypress <command> [options]
Options:
-v, --version prints Cypress version
-h, --help display help for command
*/
```
## Explicit config file location (since 1.4.0)
Sometimes `cy2` is not able to automatically detect the location of cypress package on your system. In that case you should explicitly provide environment variable `CYPRESS_PACKAGE_CONFIG_PATH` with the location of cypress's `app.yml` configuration file.
Example:
```sh
CYPRESS_API_URL="http://localhost:1234/" \
CYPRESS_PACKAGE_CONFIG_PATH="/Users/John/Cypress/8.3.0/Cypress.app/Contents/Resources/app/packages/server/config/app.yml" \
npx cy2 run --parallel --record --key somekey --ci-build-id hello-cypress
```
See [cypress agent configuration](https://docs.sorry-cypress.dev/cypress-agent/configuring-cypress-agent) for locating `app.yml` file on your system.
The injected module will be `require`d by cypress' NodeJS process before everything else. The value should be an absolute path to a compiled CommonJS module. Suitable for monkey-patching and overriding the default Cypress functionality.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc