playwright-zephyr
Version:
Zephyr reporter for the Playwright
23 lines (22 loc) • 846 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.archiveReport = archiveReport;
const path_1 = require("path");
const adm_zip_1 = __importDefault(require("adm-zip"));
function archiveReport(filename, filePath) {
try {
const zip = new adm_zip_1.default();
const jsonReportPath = (0, path_1.join)(process.cwd(), filePath, filename);
const zipPath = (0, path_1.join)(process.cwd(), filePath, `${filename}.zip`);
zip.addLocalFile(jsonReportPath);
zip.writeZip(zipPath);
return zipPath;
}
catch (error) {
console.log(`Something went wrong while archiving the report. ${error}`);
throw error;
}
}