UNPKG

stryker

Version:
47 lines 2.4 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var operators_1 = require("rxjs/operators"); var plugin_1 = require("stryker-api/plugin"); var di_1 = require("../di"); var MutationTestExecutor = /** @class */ (function () { function MutationTestExecutor(reporter, mutantTranspileScheduler, sandboxPool) { var _this = this; this.reporter = reporter; this.mutantTranspileScheduler = mutantTranspileScheduler; this.sandboxPool = sandboxPool; this.reportResult = function (mutantResult) { _this.reporter.onMutantTested(mutantResult); }; this.reportAll = function (mutantResults) { _this.reporter.onAllMutantsTested(mutantResults); }; } MutationTestExecutor.prototype.run = function (allMutants) { return tslib_1.__awaiter(this, void 0, void 0, function () { var results; return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.sandboxPool.runMutants(this.mutantTranspileScheduler.scheduleTranspileMutants(allMutants)).pipe(operators_1.tap(this.reportResult), // Signal the mutant transpiler that there is another slot open for transpiling operators_1.tap(this.mutantTranspileScheduler.scheduleNext), operators_1.toArray(), operators_1.tap(this.reportAll)).toPromise()]; case 1: results = _a.sent(); // TODO: Let typed inject dispose of sandbox pool return [4 /*yield*/, this.sandboxPool.disposeAll()]; case 2: // TODO: Let typed inject dispose of sandbox pool _a.sent(); return [4 /*yield*/, this.mutantTranspileScheduler.dispose()]; case 3: _a.sent(); return [2 /*return*/, results]; } }); }); }; MutationTestExecutor.inject = plugin_1.tokens(di_1.coreTokens.reporter, di_1.coreTokens.mutantTranspileScheduler, di_1.coreTokens.sandboxPool); return MutationTestExecutor; }()); exports.MutationTestExecutor = MutationTestExecutor; //# sourceMappingURL=MutationTestExecutor.js.map