How to use mochawesome-report-generator - 8 common examples

To help you get started, we’ve selected a few mochawesome-report-generator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mattermost / mattermost-webapp / e2e / run_tests.js View on Github external
},
                },
        });

        failedTests += totalFailed;
    }

    // Merge all json reports into one single json report
    const jsonReport = await merge({reportDir: mochawesomeReportDir});

    // Generate short summary to easily pickup via hook
    const summary = generateShortSummary(jsonReport);
    writeJsonToFile(summary, 'summary.json', mochawesomeReportDir);

    // Generate the html report file
    await generator.create(jsonReport, {reportDir: mochawesomeReportDir});

    // eslint-disable-next-line
    process.exit(failedTests); // exit with the number of failed tests
}
github ghiscoding / Angular-Slickgrid / test / cypress / cypress-mochawesome.js View on Github external
async function runTests() {
  await fse.remove('mochawesome-report') // remove the report folder
  const { totalFailed } = await cypress.run({
    browser: "chrome",
    reporter: "mochawesome",
    reporterOptions: {
      overwrite: false,
      html: false,
      json: true,
      quiet: true
    },
  }); // get the number of failed tests
  const jsonReport = await merge(); // generate JSON report
  await generator.create(jsonReport);
  process.exit(totalFailed); // exit with the number of failed tests
}
github adamgruber / mochawesome / dist / config.js View on Github external
'use strict';

var _assign = require('babel-runtime/core-js/object/assign');

var _assign2 = _interopRequireDefault(_assign);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var marge = require('mochawesome-report-generator');

// Grab shared base config from mochawesome-report-generator
var baseConfig = (0, _assign2.default)(marge.getBaseConfig(), {
  reportFilename: 'mochawesome',
  saveJson: true
});

var boolOpts = ['inlineAssets', 'autoOpen', 'enableCharts', 'enableCode', 'overwrite', 'quiet', 'dev'];

function _getOption(optToGet, options, isBool) {
  var envVar = 'MOCHAWESOME_' + optToGet.toUpperCase();
  // Order of precedence
  // 1. Config option
  // 2. Environment variable
  // 3. Base config
  if (options && typeof options[optToGet] !== 'undefined') {
    return isBool && typeof options[optToGet] === 'string' ? options[optToGet] === 'true' : options[optToGet];
  }
  if (typeof process.env[envVar] !== 'undefined') {
github adamgruber / mochawesome / src / mochawesome.js View on Github external
const rootSuite = mapSuites(this.runner.suite, totalTestsRegistered, this.config);

        const obj = {
          stats: this.stats,
          results: [ rootSuite ],
          meta: {
            mocha: {
              version: mochaPkg.version
            },
            mochawesome: {
              options: this.config,
              version: pkg.version
            },
            marge: {
              options: options.reporterOptions,
              version: margePkg.version
            }
          }
        };

        obj.stats.testsRegistered = totalTestsRegistered.total;

        const { passes, failures, pending, tests, testsRegistered } = obj.stats;
        const passPercentage = (passes / (testsRegistered - pending)) * 100;
        const pendingPercentage = (pending / testsRegistered) * 100;

        obj.stats.passPercent = passPercentage;
        obj.stats.pendingPercent = pendingPercentage;
        obj.stats.other = (passes + failures + pending) - tests; // Failed hooks
        obj.stats.hasOther = obj.stats.other > 0;
        obj.stats.skipped = testsRegistered - tests;
        obj.stats.hasSkipped = obj.stats.skipped > 0;
github adamgruber / mochawesome / dist / mochawesome.js View on Github external
function done(output, config, failures, exit) {
  return marge.create(output, config).then(function (_ref) {
    var _ref2 = (0, _slicedToArray3.default)(_ref, 2),
        htmlFile = _ref2[0],
        jsonFile = _ref2[1];

    log('Report JSON saved to ' + jsonFile, null, config);
    log('Report HTML saved to ' + htmlFile, null, config);
  }).catch(function (err) {
    log(err, 'error', config);
  }).then(function () {
    exit && exit(failures);
  });
}
github adamgruber / mochawesome / src / mochawesome.js View on Github external
function done(output, options, config, failures, exit) {
  return marge.create(output, options)
    .then(([ htmlFile, jsonFile ]) => {
      if (!htmlFile && !jsonFile) {
        log('No files were generated', 'warn', config);
      } else {
        jsonFile && log(`Report JSON saved to ${jsonFile}`, null, config);
        htmlFile && log(`Report HTML saved to ${htmlFile}`, null, config);
      }
    })
    .catch(err => {
      log(err, 'error', config);
    })
    .then(() => {
      exit && exit(failures > 0 ? 1 : 0);
    });
}
github TradeMe / tractor / plugins / mocha-specs / src / protractor / plugin.js View on Github external
protractorConfig.afterLaunch = async function (...args) {
        const reports = await existsAsync(reportDirOptions.reportDir);
        if (reports) {
            const report = await merge(reportDirOptions);
            await marge.create(report, { autoOpen, ...reportDirOptions });
            await rimrafAsync(path.resolve(reportDirOptions.reportDir, './*.json'));    
        }
        if (afterLaunch) {
            afterLaunch.call(this, ...args);
        }
    };
github YOU54F / cypress-docker-typescript / e2e / script.ts View on Github external
return merge(options).then((report: any) => 
    marge.create(report, options)
  );

mochawesome-report-generator

Generates gorgeous HTML reports from mochawesome reporter.

MIT
Latest version published 3 years ago

Package Health Score

69 / 100
Full package analysis