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_taptest_1 = require("./tapbundle.classes.taptest");
|
|
|
|
class Tap {
|
|
|
|
constructor() {
|
2017-04-28 09:00:22 +00:00
|
|
|
this.skip = {
|
|
|
|
test: (...args) => {
|
|
|
|
console.log('skipped');
|
|
|
|
}
|
|
|
|
};
|
2017-04-28 07:49:57 +00:00
|
|
|
this._tests = [];
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Normal test function, will run one by one
|
|
|
|
* @param testDescription - A description of what the test does
|
|
|
|
* @param testFunction - A Function that returns a Promise and resolves or rejects
|
|
|
|
*/
|
|
|
|
test(testDescription, testFunction) {
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
let localTest = new tapbundle_classes_taptest_1.TapTest({
|
|
|
|
description: testDescription,
|
|
|
|
testFunction: testFunction,
|
|
|
|
parallel: false
|
|
|
|
});
|
|
|
|
this._tests.push(localTest);
|
|
|
|
return localTest;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* A parallel test that will not be waited for before the next starts.
|
|
|
|
* @param testDescription - A description of what the test does
|
|
|
|
* @param testFunction - A Function that returns a Promise and resolves or rejects
|
|
|
|
*/
|
|
|
|
testParallel(testDescription, testFunction) {
|
|
|
|
this._tests.push(new tapbundle_classes_taptest_1.TapTest({
|
|
|
|
description: testDescription,
|
|
|
|
testFunction: testFunction,
|
|
|
|
parallel: true
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* tests leakage
|
|
|
|
* @param testDescription - A description of what the test does
|
|
|
|
* @param testFunction - A Function that returns a Promise and resolves or rejects
|
|
|
|
*/
|
|
|
|
testLeakage(testDescription, testFunction) {
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* starts the test evaluation
|
|
|
|
*/
|
|
|
|
start() {
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
let promiseArray = [];
|
|
|
|
// safeguard against empty test array
|
|
|
|
if (this._tests.length === 0) {
|
|
|
|
console.log('no tests specified. Ending here!');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
console.log(`1..${this._tests.length}`);
|
|
|
|
for (let testKey = 0; testKey < this._tests.length; testKey++) {
|
|
|
|
let currentTest = this._tests[testKey];
|
|
|
|
let testPromise = currentTest.run(testKey);
|
|
|
|
if (currentTest.parallel) {
|
|
|
|
promiseArray.push(testPromise);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
yield testPromise;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
yield Promise.all(promiseArray);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* handle errors
|
|
|
|
*/
|
|
|
|
threw(err) {
|
|
|
|
console.log(err);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
exports.Tap = Tap;
|
|
|
|
exports.tap = new Tap();
|
2017-04-28 09:00:22 +00:00
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFwYnVuZGxlLmNsYXNzZXMudGFwLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvdGFwYnVuZGxlLmNsYXNzZXMudGFwLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFFQSwyRUFBb0U7QUFFcEU7SUF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