All Projects → morficus → cypress-dotenv

morficus / cypress-dotenv

Licence: other
Cypress plugin that enables compatability with dotenv

Programming Languages

javascript
184084 projects - #8 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to cypress-dotenv

envy
envy: Deserialize environment variables into type-safe structs
Stars: ✭ 64 (+36.17%)
Mutual labels:  environment-variables, envvars
dart environment config
Environment specific config generator for Dart and Flutter applications during CI/CD builds
Stars: ✭ 87 (+85.11%)
Mutual labels:  dotenv, environment-variables
superconfig
Access environment variables. Also includes presence validation, type coercion and default values.
Stars: ✭ 33 (-29.79%)
Mutual labels:  dotenv, environment-variables
ngx-env
Easily inject environment variables into your Angular applications
Stars: ✭ 73 (+55.32%)
Mutual labels:  dotenv, environment-variables
angular-cli-envvars
Example project for my article "Angular CLI and OS Environment Variables"
Stars: ✭ 56 (+19.15%)
Mutual labels:  dotenv, environment-variables
pytest-envvars
Pytest plugin to validate use of envvars on your tests
Stars: ✭ 21 (-55.32%)
Mutual labels:  environment-variables, envvars
cypress-watch-and-reload
Reloads Cypress when one of the watched files changes
Stars: ✭ 46 (-2.13%)
Mutual labels:  cypress, cypress-plugin
dotenvy
Speed up your production sites by ditching .env for key/value variable pairs as Apache, Nginx, and shell equivalents
Stars: ✭ 31 (-34.04%)
Mutual labels:  dotenv, environment-variables
cypress-browserify-preprocessor
Cypress preprocessor for bundling JavaScript via browserify
Stars: ✭ 23 (-51.06%)
Mutual labels:  cypress, cypress-plugin
dotenv
Load .env files in crystal
Stars: ✭ 16 (-65.96%)
Mutual labels:  dotenv, environment-variables
cypress-xpath
Adds XPath command to Cypress test runner
Stars: ✭ 145 (+208.51%)
Mutual labels:  cypress, cypress-plugin
php-env
A small and fast .env loader for PHP
Stars: ✭ 19 (-59.57%)
Mutual labels:  dotenv, environment-variables
tfenv
Transform environment variables for use with Terraform (e.g. `HOSTNAME` ⇨ `TF_VAR_hostname`)
Stars: ✭ 120 (+155.32%)
Mutual labels:  environment-variables, envvars
webpack-dotenv-plugin
Use dotenv with webpack.
Stars: ✭ 53 (+12.77%)
Mutual labels:  dotenv, environment-variables
ini
📝 Go INI config management. support multi file load, data override merge. parse ENV variable, parse variable reference. Dotenv file parse and loader. INI配置读取管理,支持多文件加载,数据覆盖合并, 解析ENV变量, 解析变量引用。DotEnv 解析加载
Stars: ✭ 72 (+53.19%)
Mutual labels:  dotenv, environment-variables
checkdotenv
Verify environment variables presence for Node JS.
Stars: ✭ 12 (-74.47%)
Mutual labels:  dotenv, environment-variables
React Native Dotenv
Load react native environment variables using import statements for multiple env files.
Stars: ✭ 190 (+304.26%)
Mutual labels:  dotenv, environment-variables
Env Var
Verification, sanitization, and type coercion for environment variables in Node.js
Stars: ✭ 201 (+327.66%)
Mutual labels:  dotenv, environment-variables
exenv
Exenv makes loading environment variables from external sources easy.
Stars: ✭ 35 (-25.53%)
Mutual labels:  dotenv, environment-variables
cypress-get-it
Get elements by data attribute by creating a Cy command on the fly
Stars: ✭ 23 (-51.06%)
Mutual labels:  cypress, cypress-plugin

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_.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].