var __extends = (this && this.__extends) || (function () {
    var extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
(function (factory) {
    if (typeof module === "object" && typeof module.exports === "object") {
        var v = factory(require, exports);
        if (v !== undefined) module.exports = v;
    }
    else if (typeof define === "function" && define.amd) {
        define(["require", "exports", "./Coverage", "./Reporter"], factory);
    }
})(function (require, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var Coverage_1 = require("./Coverage");
    var Reporter_1 = require("./Reporter");
    /**
     * The Simple reporter outputs to the terminal console.
     */
    var Simple = (function (_super) {
        __extends(Simple, _super);
        function Simple() {
            return _super !== null && _super.apply(this, arguments) || this;
        }
        Simple.prototype.error = function (error) {
            this.console.error(this.formatError(error));
        };
        Simple.prototype.log = function (message) {
            message.split('\n').forEach(function (line) {
                console.log("DEBUG: " + line);
            });
        };
        Simple.prototype.suiteEnd = function (suite) {
            if (suite.error) {
                this.console.warn('SUITE ERROR');
                this.console.error(this.formatError(suite.error));
            }
            else {
                var numTests = suite.numTests;
                var numFailedTests = suite.numFailedTests;
                var numSkippedTests = suite.numSkippedTests;
                var message = numFailedTests + "/" + numTests + " tests failed";
                if (suite.name) {
                    message += " in " + suite.name;
                }
                if (numSkippedTests > 0) {
                    message += " (" + numSkippedTests + " skipped)";
                }
                this.console[numFailedTests ? 'warn' : 'info'](message);
            }
        };
        Simple.prototype.testEnd = function (test) {
            if (test.error) {
                this.console.error("FAIL: " + test.id + " (" + test.timeElapsed + "ms)");
                this.console.error(this.formatError(test.error, { space: '  ' }));
            }
            else if (test.skipped) {
                this.console.log("SKIP: " + test.id + " (" + test.skipped + ")");
            }
            else {
                this.console.log("PASS: " + test.id + " (" + test.timeElapsed + "ms)");
            }
        };
        __decorate([
            Reporter_1.eventHandler()
        ], Simple.prototype, "error", null);
        __decorate([
            Reporter_1.eventHandler()
        ], Simple.prototype, "log", null);
        __decorate([
            Reporter_1.eventHandler()
        ], Simple.prototype, "suiteEnd", null);
        __decorate([
            Reporter_1.eventHandler()
        ], Simple.prototype, "testEnd", null);
        return Simple;
    }(Coverage_1.default));
    exports.default = Simple;
});
//# sourceMappingURL=Simple.js.map