UNPKG

3.09 kBJavaScriptView Raw
1(function (factory) {
2 if (typeof module === "object" && typeof module.exports === "object") {
3 var v = factory(require, exports);
4 if (v !== undefined) module.exports = v;
5 }
6 else if (typeof define === "function" && define.amd) {
7 define(["require", "exports", "tslib", "./TextCoverage", "./Reporter"], factory);
8 }
9})(function (require, exports) {
10 "use strict";
11 Object.defineProperty(exports, "__esModule", { value: true });
12 var tslib_1 = require("tslib");
13 var TextCoverage_1 = tslib_1.__importDefault(require("./TextCoverage"));
14 var Reporter_1 = require("./Reporter");
15 var Simple = (function (_super) {
16 tslib_1.__extends(Simple, _super);
17 function Simple() {
18 return _super !== null && _super.apply(this, arguments) || this;
19 }
20 Simple.prototype.error = function (error) {
21 this.console.error(this.formatError(error));
22 };
23 Simple.prototype.log = function (message) {
24 var _this = this;
25 message.split('\n').forEach(function (line) {
26 _this.console.log("DEBUG: " + line);
27 });
28 };
29 Simple.prototype.suiteEnd = function (suite) {
30 if (suite.error) {
31 this.console.warn('SUITE ERROR');
32 this.console.error(this.formatError(suite.error));
33 }
34 else {
35 var numTests = suite.numTests;
36 var numFailedTests = suite.numFailedTests;
37 var numSkippedTests = suite.numSkippedTests;
38 var message = numFailedTests + "/" + numTests + " tests failed";
39 if (suite.name) {
40 message += " in " + suite.name;
41 }
42 if (numSkippedTests > 0) {
43 message += " (" + numSkippedTests + " skipped)";
44 }
45 this.console[numFailedTests ? 'warn' : 'info'](message);
46 }
47 };
48 Simple.prototype.testEnd = function (test) {
49 if (test.error) {
50 this.console.error("FAIL: " + test.id + " (" + test.timeElapsed + "ms)");
51 this.console.error(this.formatError(test.error, { space: ' ' }));
52 }
53 else if (test.skipped) {
54 this.console.log("SKIP: " + test.id + " (" + test.skipped + ")");
55 }
56 else {
57 this.console.log("PASS: " + test.id + " (" + test.timeElapsed + "ms)");
58 }
59 };
60 tslib_1.__decorate([
61 Reporter_1.eventHandler()
62 ], Simple.prototype, "error", null);
63 tslib_1.__decorate([
64 Reporter_1.eventHandler()
65 ], Simple.prototype, "log", null);
66 tslib_1.__decorate([
67 Reporter_1.eventHandler()
68 ], Simple.prototype, "suiteEnd", null);
69 tslib_1.__decorate([
70 Reporter_1.eventHandler()
71 ], Simple.prototype, "testEnd", null);
72 return Simple;
73 }(TextCoverage_1.default));
74 exports.default = Simple;
75});
76//# sourceMappingURL=Simple.js.map
\No newline at end of file