1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 |
|
7 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
8 |
|
9 | var _events = require('events');
|
10 |
|
11 | var _events2 = _interopRequireDefault(_events);
|
12 |
|
13 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
14 |
|
15 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
16 |
|
17 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
18 |
|
19 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 | var DotReporter = function (_events$EventEmitter) {
|
28 | _inherits(DotReporter, _events$EventEmitter);
|
29 |
|
30 | function DotReporter(baseReporter, config) {
|
31 | var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
32 |
|
33 | _classCallCheck(this, DotReporter);
|
34 |
|
35 | var _this = _possibleConstructorReturn(this, (DotReporter.__proto__ || Object.getPrototypeOf(DotReporter)).call(this));
|
36 |
|
37 | _this.baseReporter = baseReporter;
|
38 | var epilogue = _this.baseReporter.epilogue;
|
39 |
|
40 |
|
41 | _this.on('start', function () {
|
42 | console.log();
|
43 | });
|
44 |
|
45 | _this.on('test:pending', function () {
|
46 | _this.printDots('pending');
|
47 | });
|
48 |
|
49 | _this.on('test:pass', function () {
|
50 | _this.printDots('green');
|
51 | });
|
52 |
|
53 | _this.on('test:fail', function () {
|
54 | _this.printDots('fail');
|
55 | });
|
56 |
|
57 | _this.on('test:end', function () {
|
58 | _this.printDots(null);
|
59 | });
|
60 |
|
61 | _this.on(config.watch ? 'runner:end' : 'end', function () {
|
62 | epilogue.call(baseReporter);
|
63 | console.log();
|
64 |
|
65 | if (config.watch) {
|
66 | baseReporter.printEpilogue = true;
|
67 | baseReporter.stats.reset();
|
68 | }
|
69 | });
|
70 | return _this;
|
71 | }
|
72 |
|
73 | _createClass(DotReporter, [{
|
74 | key: 'printDots',
|
75 | value: function printDots(status) {
|
76 | var _baseReporter = this.baseReporter,
|
77 | color = _baseReporter.color,
|
78 | symbols = _baseReporter.symbols;
|
79 |
|
80 | var symbol = status === 'fail' ? 'F' : symbols.dot;
|
81 |
|
82 | if (!status) {
|
83 | return;
|
84 | }
|
85 |
|
86 |
|
87 | process.stdout.write(color(status, symbol));
|
88 | }
|
89 | }]);
|
90 |
|
91 | return DotReporter;
|
92 | }(_events2.default.EventEmitter);
|
93 |
|
94 | exports.default = DotReporter;
|
95 | module.exports = exports['default']; |
\ | No newline at end of file |