testgenius-ai
Version:
🚀 TestGenius AI - The Ultimate E2E Testing Framework for Everyone | No Coding Required • AI-Powered Automation • Beautiful Reports • Zero Complexity
32 lines • 1.43 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TestSessionManager = void 0;
const fs_extra_1 = __importDefault(require("fs-extra"));
const path_1 = __importDefault(require("path"));
class TestSessionManager {
constructor() {
this.resultsDir = path_1.default.join(process.cwd(), 'test-results');
}
async saveSession(result) {
const sessionDir = path_1.default.join(this.resultsDir, result.sessionId);
await fs_extra_1.default.ensureDir(sessionDir);
const sessionFile = path_1.default.join(sessionDir, 'session.json');
await fs_extra_1.default.writeJson(sessionFile, result, { spaces: 2 });
}
async loadSession(sessionId) {
const sessionFile = path_1.default.join(this.resultsDir, sessionId, 'session.json');
if (!(await fs_extra_1.default.pathExists(sessionFile)))
return null;
return fs_extra_1.default.readJson(sessionFile);
}
async listSessions() {
if (!(await fs_extra_1.default.pathExists(this.resultsDir)))
return [];
return (await fs_extra_1.default.readdir(this.resultsDir)).filter(f => !f.startsWith('.'));
}
}
exports.TestSessionManager = TestSessionManager;
//# sourceMappingURL=TestSessionManager.js.map