UNPKG

testplane

Version:

Tests framework based on mocha and wdio

38 lines 1.62 kB
"use strict"; const _ = require("lodash"); const BaseReporter = require("./base"); const helpers = require("./utils/helpers"); const icons = require("./utils/icons"); const { withLogOptions } = require("../utils/logger"); module.exports = class FlatReporter extends BaseReporter { constructor(...args) { super(...args); this._tests = []; } _onTestFail(test) { super._onTestFail(test); this._tests.push(helpers.extendTestInfo(test, { isFailed: true })); } _onRetry(test) { super._onRetry(test); this._tests.push(helpers.extendTestInfo(test, { isFailed: false })); } _onBeforeRunnerEnd(stats) { super._onBeforeRunnerEnd(stats); const failedTests = helpers.formatFailedTests(this._tests); const noTimestamp = withLogOptions({ timestamp: false }); failedTests.forEach((test, index) => { this.informer.log(`\n${index + 1}) ${test.fullTitle}`, noTimestamp); this.informer.log(` in file ${test.file}\n`, noTimestamp); _.forEach(test.browsers, testCase => { const icon = testCase.isFailed ? icons.FAIL : icons.RETRY; this.informer.log(` ${testCase.browserId}`, noTimestamp); if (testCase.errorSnippet) { testCase.errorSnippet.split("\n").forEach(line => this.informer.log(line, noTimestamp)); } this.informer.log(`${icon} ${testCase.error}`, withLogOptions({ timestamp: false, prefixEachLine: " ".repeat(4) })); }); }); } }; //# sourceMappingURL=flat.js.map