Comparing version 0.30.1 to 0.31.0
@@ -6,2 +6,13 @@ # Change Log | ||
<a name="0.31.0"></a> | ||
# [0.31.0](https://github.com/stryker-mutator/stryker/compare/stryker@0.30.1...stryker@0.31.0) (2018-11-07) | ||
### Features | ||
* **clear text reporter:** Prettify the clear-text report ([#1185](https://github.com/stryker-mutator/stryker/issues/1185)) ([a49829b](https://github.com/stryker-mutator/stryker/commit/a49829b)) | ||
<a name="0.30.1"></a> | ||
@@ -8,0 +19,0 @@ ## [0.30.1](https://github.com/stryker-mutator/stryker/compare/stryker@0.30.0...stryker@0.30.1) (2018-10-25) |
{ | ||
"name": "stryker", | ||
"version": "0.30.1", | ||
"version": "0.31.0", | ||
"description": "The extendable JavaScript mutation testing framework", | ||
@@ -56,3 +56,3 @@ "main": "src/Stryker.js", | ||
"dependencies": { | ||
"@stryker-mutator/util": "^0.0.1", | ||
"@stryker-mutator/util": "^0.0.2", | ||
"chalk": "~2.4.1", | ||
@@ -59,0 +59,0 @@ "commander": "~2.19.0", |
@@ -190,3 +190,6 @@ [![Build Status](https://travis-ci.org/stryker-mutator/stryker.svg?branch=master)](https://travis-ci.org/stryker-mutator/stryker) | ||
The `clear-text` reporter supports an additional config option to show more tests that were executed to kill a mutant. The config for your config file is: `clearTextReporter: { maxTestsToLog: 3 },` | ||
The `clear-text` reporter supports three additional config options: | ||
* `allowColor` to use cyan and yellow in printing source file names and positions. This defaults to `true`, so specify as `clearTextReporter: { allowColor: false },` to disable if you must. | ||
* `logTests` to log the names of unit tests that were run to allow mutants. By default, only the first three are logged. The config for your config file is: `clearTextReporter: { logTests: true },` | ||
* `maxTestsToLog` to show more tests that were executed to kill a mutant when `logTests` is true. The config for your config file is: `clearTextReporter: { logTests: true, maxTestsToLog: 7 },` | ||
@@ -193,0 +196,0 @@ The `dashboard` reporter is a special kind of reporter. It sends a report to https://dashboard.stryker-mutator.io, enabling you to add a fancy mutation score badge to your readme! To make sure no unwanted results are sent to the dashboards, it will only send the report if it is run from a build server. The reporter currently detects [Travis](https://travis-ci.org/) and [CircleCI](https://circleci.com/). Please open an [issue](https://github.com/stryker-mutator/stryker/issues/new) if your build server is missing. On all these environments, it will ignore builds of pull requests. Apart from buildserver-specific environment variables, the reporter uses one environment variable: |
@@ -0,1 +1,2 @@ | ||
"use strict"; | ||
//# sourceMappingURL=globals.js.map |
@@ -196,3 +196,3 @@ "use strict"; | ||
}; | ||
MutantTestMatcher.prototype.isCoveragePerTestResult = function (coverage) { | ||
MutantTestMatcher.prototype.isCoveragePerTestResult = function (_coverage) { | ||
return this.options.coverageAnalysis === 'perTest'; | ||
@@ -199,0 +199,0 @@ }; |
@@ -11,4 +11,5 @@ import { Reporter, MutantResult, ScoreResult } from 'stryker-api/report'; | ||
private logMutantResult; | ||
private colorSourceFileAndLocation; | ||
private logExecutedTests; | ||
onScoreCalculated(score: ScoreResult): void; | ||
} |
@@ -24,3 +24,3 @@ "use strict"; | ||
var writeLineFn = function (input) { return _this.writeLine(input); }; | ||
mutantResults.forEach(function (result) { | ||
mutantResults.forEach(function (result, index) { | ||
if (result.testsRan) { | ||
@@ -32,23 +32,21 @@ totalTests += result.testsRan.length; | ||
_this.log.debug(chalk_1.default.bold.green('Mutant killed!')); | ||
_this.logMutantResult(result, logDebugFn); | ||
_this.logMutantResult(result, index, logDebugFn); | ||
break; | ||
case report_1.MutantStatus.TimedOut: | ||
_this.log.debug(chalk_1.default.bold.yellow('Mutant timed out!')); | ||
_this.logMutantResult(result, logDebugFn); | ||
_this.logMutantResult(result, index, logDebugFn); | ||
break; | ||
case report_1.MutantStatus.RuntimeError: | ||
_this.log.debug(chalk_1.default.bold.yellow('Mutant caused a runtime error!')); | ||
_this.logMutantResult(result, logDebugFn); | ||
_this.logMutantResult(result, index, logDebugFn); | ||
break; | ||
case report_1.MutantStatus.TranspileError: | ||
_this.log.debug(chalk_1.default.bold.yellow('Mutant caused a transpile error!')); | ||
_this.logMutantResult(result, logDebugFn); | ||
_this.logMutantResult(result, index, logDebugFn); | ||
break; | ||
case report_1.MutantStatus.Survived: | ||
_this.writeLine(chalk_1.default.bold.red('Mutant survived!')); | ||
_this.logMutantResult(result, writeLineFn); | ||
_this.logMutantResult(result, index, writeLineFn); | ||
break; | ||
case report_1.MutantStatus.NoCoverage: | ||
_this.writeLine(chalk_1.default.bold.yellow('Mutant survived! (no coverage)')); | ||
_this.logMutantResult(result, writeLineFn); | ||
_this.logMutantResult(result, index, writeLineFn); | ||
break; | ||
@@ -59,5 +57,5 @@ } | ||
}; | ||
ClearTextReporter.prototype.logMutantResult = function (result, logImplementation) { | ||
logImplementation(result.sourceFilePath + ':' + result.location.start.line + ':' + result.location.start.column); | ||
logImplementation('Mutator: ' + result.mutatorName); | ||
ClearTextReporter.prototype.logMutantResult = function (result, index, logImplementation) { | ||
logImplementation(index + ". [" + report_1.MutantStatus[result.status] + "] " + result.mutatorName); | ||
logImplementation(this.colorSourceFileAndLocation(result.sourceFilePath, result.location.start)); | ||
result.originalLines.split('\n').forEach(function (line) { | ||
@@ -77,7 +75,21 @@ logImplementation(chalk_1.default.red('- ' + line)); | ||
}; | ||
ClearTextReporter.prototype.colorSourceFileAndLocation = function (sourceFilePath, position) { | ||
var clearTextReporterConfig = this.options.clearTextReporter; | ||
if (clearTextReporterConfig && clearTextReporterConfig.allowColor !== false) { | ||
return sourceFilePath + ':' + position.line + ':' + position.column; | ||
} | ||
return [ | ||
chalk_1.default.cyan(sourceFilePath), | ||
chalk_1.default.yellow("" + position.line), | ||
chalk_1.default.yellow("" + position.column), | ||
].join(':'); | ||
}; | ||
ClearTextReporter.prototype.logExecutedTests = function (result, logImplementation) { | ||
var clearTextReporterConfig = this.options.clearTextReporter; | ||
var clearTextReporterConfig = this.options.clearTextReporter || {}; | ||
if (!clearTextReporterConfig.logTests) { | ||
return; | ||
} | ||
if (result.testsRan && result.testsRan.length > 0) { | ||
var testsToLog = 3; | ||
if (clearTextReporterConfig && typeof clearTextReporterConfig.maxTestsToLog === 'number') { | ||
if (typeof clearTextReporterConfig.maxTestsToLog === 'number') { | ||
testsToLog = clearTextReporterConfig.maxTestsToLog; | ||
@@ -84,0 +96,0 @@ } |
@@ -47,3 +47,3 @@ "use strict"; | ||
}; | ||
Column.prototype.color = function (score) { | ||
Column.prototype.color = function (_score) { | ||
return function (input) { return input; }; | ||
@@ -50,0 +50,0 @@ }; |
@@ -8,5 +8,5 @@ import { Reporter, ScoreResult } from 'stryker-api/report'; | ||
private readonly ciProvider; | ||
constructor(setting: StrykerOptions, dashboardReporterClient?: DashboardReporterClient); | ||
constructor(_setting: StrykerOptions, dashboardReporterClient?: DashboardReporterClient); | ||
private readEnvironmentVariable; | ||
onScoreCalculated(ScoreResult: ScoreResult): Promise<void>; | ||
} |
@@ -9,3 +9,3 @@ "use strict"; | ||
var DashboardReporter = /** @class */ (function () { | ||
function DashboardReporter(setting, dashboardReporterClient) { | ||
function DashboardReporter(_setting, dashboardReporterClient) { | ||
if (dashboardReporterClient === void 0) { dashboardReporterClient = new DashboardReporterClient_1.default(); } | ||
@@ -12,0 +12,0 @@ this.dashboardReporterClient = dashboardReporterClient; |
@@ -92,2 +92,6 @@ "use strict"; | ||
var lineStart = 0; | ||
var markLineStart = function () { | ||
result.push(lineStart); | ||
lineStart = pos; | ||
}; | ||
while (pos < this.file.textContent.length) { | ||
@@ -101,11 +105,10 @@ var ch = this.file.textContent.charCodeAt(pos); | ||
} | ||
// falls through | ||
markLineStart(); | ||
break; | ||
case 10 /* lineFeed */: | ||
result.push(lineStart); | ||
lineStart = pos; | ||
markLineStart(); | ||
break; | ||
default: | ||
if (ch > 127 /* maxAsciiCharacter */ && isLineBreak(ch)) { | ||
result.push(lineStart); | ||
lineStart = pos; | ||
markLineStart(); | ||
} | ||
@@ -112,0 +115,0 @@ break; |
393326
7004
339
+ Added@stryker-mutator/util@0.0.2(transitive)
- Removed@stryker-mutator/util@0.0.1(transitive)
Updated@stryker-mutator/util@^0.0.2