๐Ÿš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more โ†’
Socket
DemoInstallSign in
Socket

cypress-plugin-dotenv

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cypress-plugin-dotenv

Load .env variables in Cypress

1.3.0
latest
Source
npm
Version published
Weekly downloads
1K
-10.57%
Maintainers
1
Weekly downloads
ย 
Created
Source

cypress-plugin-dotenv

npm version ย  TypeScript

โš™๏ธ Install

  • npm:
npm install cypress-plugin-dotenv
  • yarn:
yarn add cypress-plugin-dotenv
  • pnpm:
pnpm add cypress-plugin-dotenv

๐Ÿงช Usage

Import the plugin into your config file:

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:

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

License

This project is licensed under the terms of the MIT license.

Keywords

cypress

FAQs

Package last updated on 29 Aug 2023

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