UNPKG

testgenius-ai

Version:

🚀 TestGenius AI - The Ultimate E2E Testing Framework for Everyone | No Coding Required • AI-Powered Automation • Beautiful Reports • Zero Complexity

50 lines • 2.1 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.CleanupManager = void 0; const fs_extra_1 = __importDefault(require("fs-extra")); const path_1 = __importDefault(require("path")); class CleanupManager { constructor() { // TODO: Implement CleanupManager } // Placeholder methods async init() { console.log('CleanupManager initialized'); } async cleanupResults(keepCount = 10) { const resultsDir = path_1.default.join(process.cwd(), 'test-results'); if (!(await fs_extra_1.default.pathExists(resultsDir))) return; const sessionDirs = (await fs_extra_1.default.readdir(resultsDir)).filter(f => !f.startsWith('.')); if (sessionDirs.length <= keepCount) return; const sorted = sessionDirs.sort(); const toDelete = sorted.slice(0, sorted.length - keepCount); for (const dir of toDelete) { await fs_extra_1.default.remove(path_1.default.join(resultsDir, dir)); } console.log(`Cleaned up ${toDelete.length} old test results.`); } async cleanupReports(days = 30) { const reportsDir = path_1.default.join(process.cwd(), 'reports'); if (!(await fs_extra_1.default.pathExists(reportsDir))) return; const now = Date.now(); const files = (await fs_extra_1.default.readdir(reportsDir)).filter(f => f.endsWith('.html')); let deleted = 0; for (const file of files) { const filePath = path_1.default.join(reportsDir, file); const stat = await fs_extra_1.default.stat(filePath); if (now - stat.mtimeMs > days * 24 * 60 * 60 * 1000) { await fs_extra_1.default.remove(filePath); deleted++; } } console.log(`Cleaned up ${deleted} old reports.`); } } exports.CleanupManager = CleanupManager; //# sourceMappingURL=CleanupManager.js.map