- npm:
npm install cypress-plugin-dotenv
- yarn:
yarn add cypress-plugin-dotenv
- pnpm:
pnpm add cypress-plugin-dotenv
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);
}
}
});
Automate TypeScript definitions for .env
with:
import { generateEnvTypes } from 'cypress-plugin-dotenv';
on('before:browser:launch', (browser, launchOptions) => {
generateEnvTypes(outputPath, options);
// your code
});
Take a look at cypress folder
This project is licensed under the terms of the MIT license.