fix(ci): disable debug logging for dotenv configuration and remove unused statSync imports in auth setup

This commit is contained in:
GitHub Actions
2026-02-05 00:01:22 +00:00
parent 8d393b6e82
commit b0903b987f
3 changed files with 3 additions and 32 deletions

View File

@@ -9,7 +9,7 @@ import { dirname, join } from 'path';
* https://github.com/motdotla/dotenv
*/
import dotenv from 'dotenv';
dotenv.config({ path: join(dirname(fileURLToPath(import.meta.url)), '.env') });
dotenv.config({ path: join(dirname(fileURLToPath(import.meta.url)), '.env'), debug: false });
/**
* Auth state storage path - shared across all browser projects

View File

@@ -1,7 +1,7 @@
import { test as setup } from './fixtures/test';
import type { APIRequestContext } from '@playwright/test';
import { STORAGE_STATE } from './constants';
import { readFileSync, statSync } from 'fs';
import { readFileSync } from 'fs';
/**
* Authentication Setup for E2E Tests
@@ -58,21 +58,6 @@ async function performLoginAndSaveState(
await request.storageState({ path: STORAGE_STATE });
console.log(`Auth state saved to ${STORAGE_STATE}`);
// Log storage state size to diagnose CI JSON.parse OOM
try {
const { size } = statSync(STORAGE_STATE);
const sizeKiB = Math.round(size / 1024);
console.log(`Auth state size: ${size} bytes (${sizeKiB} KiB)`);
if (size > 5 * 1024 * 1024) {
console.warn(
`⚠️ Auth state file is unusually large (>5 MiB). ` +
`This can cause Node.js heap OOM when Playwright loads storageState.`
);
}
} catch (err) {
console.warn('⚠️ Could not stat auth state file:', err instanceof Error ? err.message : err);
}
// Verify cookie domain matches expected base URL
try {
const savedState = JSON.parse(readFileSync(STORAGE_STATE, 'utf-8'));

View File

@@ -24,7 +24,7 @@
import { test as base, expect } from './test';
import { request as playwrightRequest } from '@playwright/test';
import { existsSync, readFileSync, statSync } from 'fs';
import { existsSync, readFileSync } from 'fs';
import { TestDataManager } from '../utils/TestDataManager';
import { STORAGE_STATE } from '../constants';
@@ -89,20 +89,6 @@ export const test = base.extend<AuthFixtures>({
// Validate cookie domain matches baseURL to catch configuration issues early
try {
try {
const { size } = statSync(STORAGE_STATE);
const sizeKiB = Math.round(size / 1024);
console.log(`Auth state size (fixture): ${size} bytes (${sizeKiB} KiB)`);
if (size > 5 * 1024 * 1024) {
console.warn(
`⚠️ Auth state file is unusually large (>5 MiB). ` +
`This can cause Node.js heap OOM when Playwright loads storageState.`
);
}
} catch (err) {
console.warn('⚠️ Could not stat auth state file (fixture):', err instanceof Error ? err.message : err);
}
const savedState = JSON.parse(readFileSync(STORAGE_STATE, 'utf-8'));
const cookies = savedState.cookies || [];
const authCookie = cookies.find((c: { name: string }) => c.name === 'auth_token');