UNPKG

cypress-terminal-report

Version:

Better terminal and file output for cypress test logs.

28 lines (27 loc) 1.1 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const BaseOutputProcessor_1 = __importDefault(require("./BaseOutputProcessor")); const logsTxtFormatter_1 = __importDefault(require("./logsTxtFormatter")); const os_1 = require("os"); const PADDING = ' '; class TextOutputProcessor extends BaseOutputProcessor_1.default { constructor(file, options) { super(file, options); this.chunkSeparator = os_1.EOL + os_1.EOL; } write(allMessages) { Object.entries(allMessages).forEach(([spec, tests]) => { let text = `${spec}:${os_1.EOL}`; Object.entries(tests).forEach(([test, messages]) => { text += `${PADDING}${test}${os_1.EOL}`; text += (0, logsTxtFormatter_1.default)(messages, os_1.EOL); text += os_1.EOL; }); this.writeSpecChunk(spec, text); }); } } exports.default = TextOutputProcessor;