Giter Club home page Giter Club logo

cypress-dotenv's Introduction

Cypress dotenv

Cypress plugin that enables compatability with dotenv.

Build Status Maintainability Test Coverage

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 definedin 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

npm install --save-dev cypress-dotenv

or

yarn add --dev 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_.

cypress-dotenv's People

Contributors

dependabot[bot] avatar e-ndrus avatar echernyavskiy avatar morficus avatar pke avatar vinbarnes avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.