New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@devmy/cypress-dotenv

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@devmy/cypress-dotenv

integrate `dotenv` configuration with `@dotenv-run/core` into your Cypress setup, simplifying the management of environment variables for both component and end-to-end (E2E) tests.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

@devmy/cypress-dotenv

@devmy/cypress-dotenv is a TypeScript library designed to integrate dotenv configuration with @dotenv-run/core into your Cypress setup, simplifying the management of environment variables for both component and end-to-end (E2E) tests.

  • ✅ Load environment variables from .env files
  • ✅ Load environment variables from .env.vault files
  • ✅ Expand environment variables API_URL=$API_BASE/users
  • ✅ Define environment variables for a specific environment (e.g. .env.production)
  • ✅ Load priorities of .env.* files (e.g. .env.production > .env)
  • ✅ Hierarchical cascading configuration in monorepo projects (Nx, Turbo, etc.) apps/next-app/.env > apps/.env > .env

Installation

Install the package via npm:

npm install @devmy/cypress-dotenv

or via yarn:

yarn add @devmy/cypress-dotenv

or via pnpm:

pnpm add @devmy/cypress-dotenv

Usage

Dotenv Configuration

The dotenv configuration options in this library use DotenvRunOptions of dotenv-run/core.

defineConfigWithDotenv

The defineConfigWithDotenv function invokes Cypress's defineConfig, loading environment variables from dotenv.

Example:
import { defineConfigWithDotenv } from '@devmy/cypress-dotenv';

export default defineConfigWithDotenv({
   dotenv: {
    prefix: 'FRONTEND_E2E_',
    root: '../../',
  },
  component: {
    specPattern: 'src/**/*.cy.ts',
  },
  e2e: {
    baseUrl: 'http://localhost:3000',
  },
});

dotenvComponentPreset

The dotenvComponentPreset function loads dotenv for component tests in Cypress.

Example:
import { dotenvComponentPreset } from '@devmy/cypress-dotenv';

export default dotenvComponentPreset({
  dotenv: {
    prefix: 'FRONTEND_E2E_',
    root: '../../',
  },
  devServer: {
    framework: 'react',
    bundler: 'webpack',
  },
});

dotenvE2EPreset

The dotenvE2EPreset function loads dotenv for E2E tests in Cypress.

Example:
import { dotenvE2EPreset } from '@devmy/cypress-dotenv';

export default dotenvE2EPreset({
  dotenv: {
    prefix: 'FRONTEND_E2E_',
    root: '../../',
  },
  baseUrl: 'http://localhost:3000',
});

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any changes.

Keywords

FAQs

Package last updated on 04 Jun 2024

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