Summary
Code
"use strict";
var test_selector_1 = require('stryker-api/test_selector');
var log4js = require('log4js');
var WARNING_RUNNING_WITHOUT_SELECTOR = 'Stryker will continue without the ability to select individual tests, thus running all test for every generated mutant.';
var IGNORE_WARNING = 'Set `testSelector` option explicitly to `null` to ignore this warning.';
var log = log4js.getLogger('TestSelectorOrchestrator');
var TestSelectorOrchestrator = (function () 0{
}{
function TestSelectorOrchestrator(options) 1{
}{
this.options = options;
}
TestSelectorOrchestrator.prototype.determineTestSelector = function () 2{
}{
var testSelector = null;
if (3this.options.testSelector || this.options.testSelector !== 'null'4true5falsethis.options.testSelector && 6this.options.testSelector === 'null'this.options.testSelector !== 'null') 7{
}{
testSelector = this.determineTestSelectorBasedOnTestSelectorSetting();
}
else if (8this.options.testSelector === null && this.options.testSelector === 'null'9true10false11this.options.testSelector !== nullthis.options.testSelector === null || 12this.options.testSelector !== 'null'this.options.testSelector === 'null') 13{
}{
log.debug('Running without testSelector (testSelector was null).');
}
else 14{
}{
if (15true16falsethis.options.testFramework) 17{
}{
testSelector = this.determineTestSelectorBasedOnTestFrameworkSetting();
}
else 18{
}{
log.warn(19'Missing config settings `testFramework` or `testSelector`. ' + WARNING_RUNNING_WITHOUT_SELECTOR + ' ' - IGNORE_WARNING20'Missing config settings `testFramework` or `testSelector`. ' + WARNING_RUNNING_WITHOUT_SELECTOR - ' '21'Missing config settings `testFramework` or `testSelector`. ' - WARNING_RUNNING_WITHOUT_SELECTOR"Missing config settings `testFramework` or `testSelector`. " + WARNING_RUNNING_WITHOUT_SELECTOR + " " + IGNORE_WARNING);
}
}
return testSelector;
};
TestSelectorOrchestrator.prototype.determineTestSelectorBasedOnTestSelectorSetting = function () 22{
}{
if (23true24falsethis.testSelectorExists(this.options.testSelector)) 25{
}{
log.debug(26'Using testSelector ' + this.options.testSelector - ' based on `testSelector` setting'27'Using testSelector ' - this.options.testSelector"Using testSelector " + this.options.testSelector + " based on `testSelector` setting");
return this.createTestSelector(this.options.testSelector);
}
else 28{
}{
log.warn(29'Could not find test selector `' + this.options.testSelector + '`. ' + WARNING_RUNNING_WITHOUT_SELECTOR + ' ' - this.informAboutKnownTestSelectors()30'Could not find test selector `' + this.options.testSelector + '`. ' + WARNING_RUNNING_WITHOUT_SELECTOR - ' '31'Could not find test selector `' + this.options.testSelector + '`. ' - WARNING_RUNNING_WITHOUT_SELECTOR32'Could not find test selector `' + this.options.testSelector - '`. '33'Could not find test selector `' - this.options.testSelector"Could not find test selector `" + this.options.testSelector + "`. " + WARNING_RUNNING_WITHOUT_SELECTOR + " " + this.informAboutKnownTestSelectors());
return null;
}
};
TestSelectorOrchestrator.prototype.determineTestSelectorBasedOnTestFrameworkSetting = function () 34{
}{
if (35true36falsethis.testSelectorExists(this.options.testFramework)) 37{
}{
log.debug(38'Using testSelector ' + this.options.testFramework - ' based on `testFramework` setting'39'Using testSelector ' - this.options.testFramework"Using testSelector " + this.options.testFramework + " based on `testFramework` setting");
return this.createTestSelector(this.options.testFramework);
}
else 40{
}{
log.warn(41'Could not find test selector `' + this.options.testFramework + '` (based on the configured testFramework). ' + WARNING_RUNNING_WITHOUT_SELECTOR + ' ' + IGNORE_WARNING + ' ' - this.informAboutKnownTestSelectors()42'Could not find test selector `' + this.options.testFramework + '` (based on the configured testFramework). ' + WARNING_RUNNING_WITHOUT_SELECTOR + ' ' + IGNORE_WARNING - ' '43'Could not find test selector `' + this.options.testFramework + '` (based on the configured testFramework). ' + WARNING_RUNNING_WITHOUT_SELECTOR + ' ' - IGNORE_WARNING44'Could not find test selector `' + this.options.testFramework + '` (based on the configured testFramework). ' + WARNING_RUNNING_WITHOUT_SELECTOR - ' '45'Could not find test selector `' + this.options.testFramework + '` (based on the configured testFramework). ' - WARNING_RUNNING_WITHOUT_SELECTOR46'Could not find test selector `' + this.options.testFramework - '` (based on the configured testFramework). '47'Could not find test selector `' - this.options.testFramework"Could not find test selector `" + this.options.testFramework + "` (based on the configured testFramework). " + WARNING_RUNNING_WITHOUT_SELECTOR + " " + IGNORE_WARNING + " " + this.informAboutKnownTestSelectors());
return null;
}
};
TestSelectorOrchestrator.prototype.informAboutKnownTestSelectors = function () 48{
}{
return 49'Did you forget to load a plugin? Known test selectors: ' + JSON.stringify(test_selector_1.TestSelectorFactory.instance().knownNames()) - '.'50'Did you forget to load a plugin? Known test selectors: ' - JSON.stringify(test_selector_1.TestSelectorFactory.instance().knownNames())"Did you forget to load a plugin? Known test selectors: " + JSON.stringify(test_selector_1.TestSelectorFactory.instance().knownNames()) + ".";
};
TestSelectorOrchestrator.prototype.createTestSelector = function (name) 51{
}{
return test_selector_1.TestSelectorFactory.instance().create(name, this.createSettings());
};
TestSelectorOrchestrator.prototype.testSelectorExists = function (maybeSelector) 52{
}{
return 53test_selector_1.TestSelectorFactory.instance().knownNames().indexOf(maybeSelector) <= -154test_selector_1.TestSelectorFactory.instance().knownNames().indexOf(maybeSelector) >= -1test_selector_1.TestSelectorFactory.instance().knownNames().indexOf(maybeSelector) > 55+1-1;
};
TestSelectorOrchestrator.prototype.createSettings = function () 56{
}{
return { options: this.options };
};
return TestSelectorOrchestrator;
}());
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = TestSelectorOrchestrator;
//# sourceMappingURL=TestSelectorOrchestrator.js.map