chore: refactor env config

This commit is contained in:
David Nguyen
2024-03-27 15:17:10 +08:00
parent 074adccae2
commit f88faa43d9
2 changed files with 8 additions and 1 deletions

View File

@ -2,7 +2,13 @@ import { defineConfig, devices } from '@playwright/test';
import dotenv from 'dotenv';
import path from 'path';
dotenv.config({ path: path.resolve(__dirname, '../../', '.env.local') });
const ENV_FILES = ['.env', '.env.local', `.env.${process.env.NODE_ENV || 'development'}`];
ENV_FILES.forEach((file) => {
dotenv.config({
path: path.join(__dirname, `../../${file}`),
});
});
/**
* See https://playwright.dev/docs/test-configuration.