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

cypress-dotenv

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cypress-dotenv

Cypress plugin that enables compatability with dotenv

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
74K
increased by11.95%
Maintainers
1
Weekly downloads
 
Created
Source

Cypress dotenv

Cypress plugin that enables compatability with dotenv.

Build Status Maintainability Test Coverage

Please note that as of v2.0 this plugin only support Node v10+, Cypress 8+ and dotenv 10+
If you are still using older versions, then please install v1.x instead

What does this thing do?

It will load any environment variables defined in your .env file so you can access them via Cypress.env() from within your tests as you would expect.

Any Cypress config options defined in your .env will also be applied and take precedence over what is in your cypress.json file. See the Cypress docs for details on this

For example, if your .env file has something like this:

CYPRESS_HELLO=hola
GOODBYE=adios

You can use Cypress.env('HELLO') to access its value.

Install

You will also need to install the original dotenv package along with cypress-dotenv

npm install --save-dev dotenv cypress-dotenv 

or

yarn add --dev dotenv cypress-dotenv

Configure

Since this is a plugin, you will need to modify your file cypress/plugins/index.js to look something like this:

const dotenvPlugin = require('cypress-dotenv');
module.exports = (on, config) => {
  config = dotenvPlugin(config)
  return config
}

Options

This plugin takes three paramaters. The first parameter (which is mandatory) is the Cypress config object.

The second is an optional dotenv config object.

The third is an optional [all] boolean parameter, which is set to false by default. If set to true, it returns all available environmental variables, not limited to those prefixed with CYPRESS_.

Keywords

FAQs

Package last updated on 15 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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