definition-tester
Version:
DefinitelyTyped repository testing infrastructure
59 lines • 2.11 kB
JavaScript
;
var Promise = require('bluebird');
var Timer_1 = require('../util/Timer');
var TscTest_1 = require('../tsc/TscTest');
var TestQueue_1 = require('../test/TestQueue');
var TestSuiteBase = (function () {
function TestSuiteBase(options, testSuiteName, errorHeadline) {
this.timer = new Timer_1.default();
this.testResults = [];
this.printErrorCount = true;
this.options = options;
this.testSuiteName = testSuiteName;
this.errorHeadline = errorHeadline;
this.queue = new TestQueue_1.default(options.concurrent);
}
TestSuiteBase.prototype.start = function (targetFiles, testCallback) {
var _this = this;
this.timer.start();
return Promise.map(targetFiles, function (targetFile) {
return _this.runTest(targetFile).then(function (result) {
testCallback(result);
});
}).then(function () {
_this.timer.end();
return _this;
});
};
TestSuiteBase.prototype.runTest = function (targetFile) {
var _this = this;
return this.queue.run(new TscTest_1.default(this, targetFile, {
tscPath: this.options.tscPath
})).then(function (result) {
_this.testResults.push(result);
return result;
});
};
Object.defineProperty(TestSuiteBase.prototype, "okTests", {
get: function () {
return this.testResults.filter(function (r) {
return r.success;
});
},
enumerable: true,
configurable: true
});
Object.defineProperty(TestSuiteBase.prototype, "ngTests", {
get: function () {
return this.testResults.filter(function (r) {
return !r.success;
});
},
enumerable: true,
configurable: true
});
return TestSuiteBase;
}());
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = TestSuiteBase;
//# sourceMappingURL=TestSuiteBase.js.map