Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quelle  json-mocha-reporter.js   Sprache: JAVA

 
const mocha = require('mocha');
module.exports = JSONExtra;

const constants = mocha.Runner.constants;

/*

This is a copy of
https://github.com/mochajs/mocha/blob/master/lib/reporters/json-stream.js
with more event hooks. mocha does not support extending reporters or using
multiple reporters so a custom reporter is needed and it must be local
to the project.

*/


function JSONExtra(runner, options) {
  mocha.reporters.Base.call(this, runner, options);
  mocha.reporters.JSON.call(this, runner, options);
  const self = this;

  runner.once(constants.EVENT_RUN_BEGIN, function () {
    writeEvent(['start', {total: runner.total}]);
  });

  runner.on(constants.EVENT_TEST_PASS, function (test) {
    writeEvent(['pass', clean(test)]);
  });

  runner.on(constants.EVENT_TEST_FAIL, function (test, err) {
    test = clean(test);
    test.err = err.message;
    test.stack = err.stack || null;
    writeEvent(['fail', test]);
  });

  runner.once(constants.EVENT_RUN_END, function () {
    writeEvent(['end', self.stats]);
  });

  runner.on(constants.EVENT_TEST_BEGIN, function (test) {
    writeEvent(['test-start', clean(test)]);
  });

  runner.on(constants.EVENT_TEST_PENDING, function (test) {
    writeEvent(['pending', clean(test)]);
  });
}

function writeEvent(event) {
  process.stdout.write(JSON.stringify(event) + '\n');
}

/**
 * Returns an object literal representation of `test`
 * free of cyclic properties, etc.
 *
 * @private
 * @param {Object} test - Instance used as data source.
 * @return {Object} object containing pared-down test instance data
 */

function clean(test) {
  return {
    title: test.title,
    fullTitle: test.fullTitle(),
    file: test.file,
    duration: test.duration,
    currentRetry: test.currentRetry(),
  };
}

Messung V0.5
C=98 H=100 G=98

¤ Dauer der Verarbeitung: 0.0 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge