Skip to content

Commit

Permalink
test: fixing .env file missing error
Browse files Browse the repository at this point in the history
  • Loading branch information
alexneo2003 committed Sep 19, 2024
1 parent 43490e0 commit d5a94aa
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tests/reporter/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import { defineConfig } from '@playwright/test';
import dotenv from 'dotenv';
import * as fs from 'fs';
import * as path from 'path';

dotenv.config({
path: require.resolve('../../.env'),
});
const envPath = path.resolve(__dirname, '../../.env');

if (fs.existsSync(envPath)) {
dotenv.config({ path: envPath });
} else {
console.warn(`.env file not found at ${envPath}, skipping dotenv configuration.`);
}

export default defineConfig({
testDir: __dirname,
Expand Down

0 comments on commit d5a94aa

Please sign in to comment.