Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | 1x 1x 1x 1x 1x 69x 69x 69x 69x 69x 69x 69x 69x 69x 1x 6x 1x 15x 1x 8x 1x 16x 1x 24x 4x 20x 7x 13x 1x 1x 1x 35x 1x 2x 1x 1x 1x 36x 1x 7x 1x 1x 1x 1x 1x 1x 1x 1x 1x 45x 1x 32x 1x 18x 1x 25x 1x 23x 1x 17x 1x 4x 1x 2x 1x 28x 1x 10x 1x 4x 1x 22x 1x 1x 2x 1x 1x 19x 1x 10x 1x 1x 1x | 'use strict';
const SUCCESS = 'success',
FAIL = 'fail',
ERROR = 'error',
WARNING = 'warning',
COLORS = {
success: 'green',
fail: 'red',
error: 'red',
warning: 'yellow'
};
function Result() {
this.status = undefined;
this.desc = undefined;
this.uri = undefined;
this.timestamp = undefined;
this.duration = undefined;
this.successes = [];
this.failures = [];
this.errors = [];
this.info = {};
}
Result.prototype.success = function () {
this.status = SUCCESS;
};
Result.prototype.fail = function () {
this.status = FAIL;
};
Result.prototype.error = function () {
this.status = ERROR;
};
Result.prototype.warning = function () {
this.status = WARNING;
};
Result.prototype.setStatusByStats = function () {
if (this.errors.length > 0) {
this.status = ERROR;
} else if (this.failures.length > 0) {
this.status = FAIL;
} else {
this.status = SUCCESS;
}
};
Result.prototype.getStatus = function () {
return this.status;
};
Result.prototype.getStatusColor = function () {
return COLORS[this.status];
};
Result.prototype.setName = function (name) {
this.name = name;
};
Result.prototype.getName = function () {
return this.name;
};
Result.prototype.setDescription = function (desc) {
this.desc = desc;
};
Result.prototype.getDescription = function () {
return this.desc;
};
Result.prototype.setUri = function (uri) {
this.uri = uri;
};
Result.prototype.getUri = function () {
return this.uri;
};
Result.prototype.setTimestamp = function (timestamp) {
this.timestamp = timestamp;
};
Result.prototype.getTimestamp = function () {
return this.timestamp;
};
Result.prototype.setDuration = function (duration) {
this.duration = duration;
};
Result.prototype.getDuration = function () {
return this.duration;
};
Result.prototype.isSuccess = function () {
return this.status === SUCCESS;
};
Result.prototype.isFail = function () {
return this.status === FAIL;
};
Result.prototype.isError = function () {
return this.status === ERROR;
};
Result.prototype.isWarning = function () {
return this.status === WARNING;
};
Result.prototype.getSuccesses = function () {
return this.successes;
};
Result.prototype.getFailures = function () {
return this.failures;
};
Result.prototype.getErrors = function () {
return this.errors;
};
Result.prototype.getInfo = function () {
return this.info;
};
Result.prototype.addSuccess = function (success) {
this.successes.push(success);
};
Result.prototype.addFailure = function (failure) {
this.failures.push(failure);
};
Result.prototype.addError = function (error) {
this.errors.push(error);
};
Result.prototype.addInfo = function (type, info) {
this.info[type] = info;
};
Result.prototype.addSuccesses = function (successes) {
this.successes = this.successes.concat(successes);
};
Result.prototype.addFailures = function (failures) {
this.failures = this.failures.concat(failures);
};
Result.prototype.addErrors = function (errors) {
this.errors = this.errors.concat(errors);
};
Result.prototype.hasSuccess = function () {
return this.successes.length > 0;
};
Result.prototype.hasFailure = function () {
return this.failures.length > 0;
};
Result.prototype.hasError = function () {
return this.errors.length > 0;
};
Result.prototype.hasInfo = function () {
return Object.keys(this.info).length > 0;
};
module.exports = Result;
|