# cypress-plugin-dotenv

> Load .env variables in Cypress

Latest version **1.3.0** (published 2023-08-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install cypress-plugin-dotenv
pnpm add cypress-plugin-dotenv
yarn add cypress-plugin-dotenv
bun add cypress-plugin-dotenv
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.0 |
| Published | 2023-08-29 |
| First published | 2023-08-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=18 |
| Dependencies | 1 |
| Unpacked size | 7.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | MohamadKh75 |
| Maintainers | mohamadkh75 |
| Keywords | cypress, cypress plugin, cypress dotenv, cypress environment variables, env variables, environment variables |

## Links

- npm: https://www.npmjs.com/package/cypress-plugin-dotenv
- Repository: https://github.com/MohamadKh75/cypress-plugin-dotenv
- Homepage: https://github.com/MohamadKh75/cypress-plugin-dotenv#readme
- Issues: https://github.com/MohamadKh75/cypress-plugin-dotenv/issues
- npm.io page: https://npm.io/package/cypress-plugin-dotenv

## Dependencies (1)

- [dotenv](https://npm.io/package/dotenv.md) ^16.3.1

## Alternatives

- [replicas-cli](https://npm.io/package/replicas-cli.md) — 3.0K weekly downloads
- [env-contract](https://npm.io/package/env-contract.md) — 133 weekly downloads
- [@openveo/api](https://npm.io/package/@openveo/api.md) — 61 weekly downloads
- [@ryniaubenpm2/cumque-error-reiciendis](https://npm.io/package/@ryniaubenpm2/cumque-error-reiciendis.md) — 54 weekly downloads
- [ts-global-type-extra](https://npm.io/package/ts-global-type-extra.md) — 11 weekly downloads

## Recent versions

- 1.3.0 (latest) — 2023-08-29
- 1.2.1 — 2023-08-14
- 1.2.0 — 2023-08-13
- 1.1.0 — 2023-08-12
- 1.0.2 — 2023-08-12
- 1.0.1 — 2023-08-12
- 1.0.0 — 2023-08-12

## README

<div align="center">

# cypress-plugin-dotenv

[![npm version](https://badge.fury.io/js/cypress-plugin-dotenv.svg)](https://badge.fury.io/js/cypress-plugin-dotenv) &nbsp; [![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](https://www.typescriptlang.org/)

</div>

## ⚙️ Install

- npm:

```shell
npm install cypress-plugin-dotenv
```

- yarn:

```shell
yarn add cypress-plugin-dotenv
```

- pnpm:

```shell
pnpm add cypress-plugin-dotenv
```

## 🧪 Usage

Import the plugin into your [config file](https://docs.cypress.io/guides/references/configuration):

```js
import { dotenv } from 'cypress-plugin-dotenv';
// or
const dotenv = require('cypress-plugin-dotenv');

export default defineConfig({
  e2e: {
    setupNodeEvents: (_, config) => {
      return dotenv(config);
    }
  }
});
```

## 🔧 Dynamic Types

Automate TypeScript definitions for `.env` with:

```js
import { generateEnvTypes } from 'cypress-plugin-dotenv';

on('before:browser:launch', (browser, launchOptions) => {
  generateEnvTypes(outputPath, options);

  // your code
});
```

**⚠️ Important**: Run Cypress once after setup to initialize the types.

## 📐 Example

Take a look at [cypress folder](./cypress/)

## License

This project is licensed under the terms of the [MIT license](/LICENSE.md).

---
_Source: https://npm.io/package/cypress-plugin-dotenv · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
