UNPKG

tdpw

Version:

CLI tool for uploading Playwright test reports to TestDino platform with TestDino storage support

57 lines 2.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SystemCollector = void 0; const tslib_1 = require("tslib"); const os_1 = tslib_1.__importDefault(require("os")); /** * Collector for system metadata */ class SystemCollector { /** * Gather system metadata */ static collect() { const hostname = os_1.default.hostname() || 'unknown'; const cpus = os_1.default.cpus(); const cpuCount = cpus.length || 0; const cpuModel = cpus[0]?.model || 'unknown'; const totalMemBytes = os_1.default.totalmem(); const totalMemGB = Math.round(totalMemBytes / 1024 ** 3); const memoryTotal = totalMemBytes > 0 ? `${totalMemGB} GB` : 'unknown'; const osInfo = `${os_1.default.type()} ${os_1.default.release()}`; const nodeVersion = process.version || 'unknown'; let playwrightVersion = 'unknown'; try { // Attempt to read Playwright version from package // eslint-disable-next-line @typescript-eslint/no-require-imports const pkg = require('playwright/package.json'); playwrightVersion = pkg.version || 'unknown'; } catch { // Try alternative paths for Playwright version try { // eslint-disable-next-line @typescript-eslint/no-require-imports const pkg = require('@playwright/test/package.json'); playwrightVersion = pkg.version || 'unknown'; } catch { // Keep default 'unknown' } } return { hostname, cpu: { count: cpuCount, model: cpuModel, }, memory: { total: memoryTotal, }, os: osInfo, nodejs: nodeVersion, playwright: playwrightVersion, }; } } exports.SystemCollector = SystemCollector; //# sourceMappingURL=system.js.map