tapbundle/dist/tapbundle.classes.taptest.js

57 lines
4.4 KiB
JavaScript
Raw Normal View History

2017-04-28 07:49:57 +00:00
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const tapbundle_classes_taptools_1 = require("./tapbundle.classes.taptools");
// imported interfaces
const early_1 = require("early");
class TapTest {
/**
* constructor
*/
constructor(optionsArg) {
this.description = optionsArg.description;
this.hrtMeasurement = new early_1.HrtMeasurement();
this.parallel = optionsArg.parallel;
this.status = 'pending';
this.tapTools = new tapbundle_classes_taptools_1.TapTools(this);
this.testFunction = optionsArg.testFunction;
}
/**
* run the test
*/
run(testKeyArg) {
return __awaiter(this, void 0, void 0, function* () {
this.hrtMeasurement.start();
try {
yield this.testFunction(this.tapTools);
if (this.status === 'timeout') {
throw new Error('Test succeeded, but timed out...');
}
this.hrtMeasurement.stop();
console.log(`ok ${testKeyArg + 1} - ${this.description} # time=${this.hrtMeasurement.milliSeconds}ms`);
this.status = 'success';
}
catch (err) {
this.hrtMeasurement.stop();
console.log(`not ok ${testKeyArg + 1} - ${this.description} # time=${this.hrtMeasurement.milliSeconds}ms`);
if (this.status === 'success') {
this.status = 'errorAfterSuccess';
console.log('!!! ALERT !!!: weird behaviour, since test has been already successfull');
}
if (this.failureAllowed) {
console.log(`please note: failure allowed!`);
}
console.log(err);
}
});
}
}
exports.TapTest = TapTest;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFwYnVuZGxlLmNsYXNzZXMudGFwdGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJ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