tdpw
Version:
CLI tool for uploading Playwright test reports to TestDino platform with Azure storage support
49 lines • 1.59 kB
JavaScript
;
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();
const cpus = os_1.default.cpus();
const cpuCount = cpus.length;
const cpuModel = cpus[0]?.model || 'unknown';
const totalMemBytes = os_1.default.totalmem();
const totalMemGB = Math.round(totalMemBytes / (1024 ** 3));
const memoryTotal = `${totalMemGB} GB`;
const osInfo = `${os_1.default.type()} ${os_1.default.release()}`;
const nodeVersion = process.version;
let playwrightVersion;
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;
}
catch {
// ignore if not installed
}
return {
hostname,
cpu: {
count: cpuCount,
model: cpuModel,
},
memory: {
total: memoryTotal,
},
os: osInfo,
nodejs: nodeVersion,
playwright: playwrightVersion || 'unknown',
};
}
}
exports.SystemCollector = SystemCollector;
//# sourceMappingURL=system.js.map