Code coverage report for preceptor-reporter/lib/reporter/summary.js

Statements: 100% (39 / 39)      Branches: 73.33% (22 / 30)      Functions: 100% (2 / 2)      Lines: 100% (39 / 39)      Ignored: none     

All files » preceptor-reporter/lib/reporter/ » summary.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93      1             1                 2   2 2   2 2                       2       2   2 2   2 1     2 2 1   2   2 2 1   2   2 2 1   2   2 2 1   2   2 2 1   2   2 2 1   2     2       1  
// Copyright 2014, Yahoo! Inc.
// Copyrights licensed under the Mit License. See the accompanying LICENSE file for terms.
 
var AbstractReporter = require('../abstractReporter');
 
/**
 * @class SummaryReporter
 * @extends AbstractReporter
 * @constructor
 */
var SummaryReporter = AbstractReporter.extend(
 
	{
		/**
		 * Initializes the instance
		 *
		 * @method initialize
		 */
		initialize: function () {
			this.__super();
 
			Eif (this.getOptions().progress === undefined) {
				this.getOptions().progress = false;
			}
			Eif (this.getOptions().output === undefined) {
				this.getOptions().output = true;
			}
		},
 
 
		/**
		 * Called when reporting stops
		 *
		 * @method stop
		 */
		stop: function () {
 
			var tree,
				outcomes,
				begin = '', end = '';
 
			this.__super();
 
			tree = this.getContainer().getTree();
			outcomes = this.getContainer().gatherTestOutcomes(tree);
 
			if (this.useColor()) {
				end = '\x1B[0m';
			}
 
			Eif (outcomes.passed > 0) {
				if (this.useColor()) {
					begin = '\x1B[32m';
				}
				this.console(undefined, "stop", begin + outcomes.passed + " passed" + end + "\n");
			}
			Eif (outcomes.failed > 0) {
				if (this.useColor()) {
					begin = '\x1B[31m';
				}
				this.console(undefined, "stop", begin + outcomes.failed + " failed" + end + "\n");
			}
			Eif (outcomes.error > 0) {
				if (this.useColor()) {
					begin = '\x1B[31m';
				}
				this.console(undefined, "stop", begin + outcomes.error + " errors" + end + "\n");
			}
			Eif (outcomes.skipped > 0) {
				if (this.useColor()) {
					begin = '\x1B[35m';
				}
				this.console(undefined, "stop", begin + outcomes.skipped + " skipped" + end + "\n");
			}
			Eif (outcomes.incomplete > 0) {
				if (this.useColor()) {
					begin = '\x1B[34m';
				}
				this.console(undefined, "stop", begin + outcomes.incomplete + " incomplete" + end + "\n");
			}
			Eif (outcomes.undef > 0) {
				if (this.useColor()) {
					begin = '\x1B[33m';
				}
				this.console(undefined, "stop", begin + outcomes.undef + " undefined" + end + "\n");
			}
 
			this.console(undefined, "stop", "\n");
		}
	});
 
module.exports = SummaryReporter;