stryker-html-reporter
Advanced tools
Comparing version 0.7.1 to 0.7.2
@@ -6,2 +6,13 @@ # Change Log | ||
<a name="0.7.2"></a> | ||
## [0.7.2](https://github.com/stryker-mutator/stryker/compare/stryker-html-reporter@0.7.1...stryker-html-reporter@0.7.2) (2017-09-09) | ||
### Bug Fixes | ||
* **one file directories:** Add support single file dirs ([#377](https://github.com/stryker-mutator/stryker/issues/377)) ([27c3e10](https://github.com/stryker-mutator/stryker/commit/27c3e10)) | ||
<a name="0.7.1"></a> | ||
@@ -8,0 +19,0 @@ ## [0.7.1](https://github.com/stryker-mutator/stryker/compare/stryker-html-reporter@0.7.0...stryker-html-reporter@0.7.1) (2017-09-03) |
{ | ||
"name": "stryker-html-reporter", | ||
"version": "0.7.1", | ||
"version": "0.7.2", | ||
"description": "An html reporter for the JavaScript mutation testing framework Stryker", | ||
@@ -13,3 +13,3 @@ "main": "src/index.js", | ||
"start": "tsc -w -p .", | ||
"test": "nyc --reporter=html --report-dir=reports/coverage --check-coverage --lines 95 --functions 95 --branches 94 mocha \"test/helpers/*.js\" \"test/unit/*.js\" \"test/integration/*.js\"" | ||
"test": "nyc --reporter=html --report-dir=reports/coverage --check-coverage --lines 95 --functions 95 --branches 90 mocha \"test/helpers/*.js\" \"test/unit/*.js\" \"test/integration/*.js\"" | ||
}, | ||
@@ -16,0 +16,0 @@ "repository": { |
@@ -6,3 +6,2 @@ "use strict"; | ||
var path = require("path"); | ||
var fs = require("mz/fs"); | ||
var util = require("./util"); | ||
@@ -57,3 +56,3 @@ var templates = require("./templates"); | ||
return util.mkdir(currentDirectory) | ||
.then(function (_) { return fs.writeFile(location, fileContent); }) | ||
.then(function (_) { return util.writeFile(location, fileContent); }) | ||
.then(function (_) { return _this.writeChildren(scoreResult, currentDirectory, depth); }) | ||
@@ -66,10 +65,6 @@ .then(function (_) { return location; }); | ||
if (child.representsFile) { | ||
return _this.writeReportFile(child, currentDirectory, depth); | ||
return _this.writeReportFile(child, currentDirectory, depth + util.countPathSep(child.name)); | ||
} | ||
else { | ||
// New depth is dependent on the depth of the child. | ||
// - If the child name is 'a.js', it should be depth + 1 | ||
// - If the child name is 'a/b.js', it should be depth + 2 | ||
// etc | ||
var newDepth = child.name.split(path.sep).length + depth; | ||
var newDepth = util.countPathSep(child.name) + depth + 1; | ||
return _this.writeReportDirectory(child, path.join(currentDirectory, child.name), newDepth, child.name) | ||
@@ -81,4 +76,9 @@ .then(function (_) { return void 0; }); | ||
HtmlReporter.prototype.writeReportFile = function (scoreResult, baseDir, depth) { | ||
var fileContent = templates.sourceFile(scoreResult, this.findFile(scoreResult.path), this.findMutants(scoreResult.path), depth, this.options.thresholds); | ||
return fs.writeFile(path.join(baseDir, scoreResult.name + ".html"), fileContent); | ||
if (scoreResult.representsFile) { | ||
var fileContent = templates.sourceFile(scoreResult, this.findFile(scoreResult.path), this.findMutants(scoreResult.path), depth, this.options.thresholds); | ||
return util.writeFile(path.join(baseDir, scoreResult.name + ".html"), fileContent); | ||
} | ||
else { | ||
return Promise.resolve(); // not a report file | ||
} | ||
}; | ||
@@ -85,0 +85,0 @@ HtmlReporter.prototype.findFile = function (filePath) { |
@@ -112,4 +112,3 @@ "use strict"; | ||
return 'danger'; | ||
case report_1.MutantStatus.TimedOut: | ||
case report_1.MutantStatus.Error: | ||
default: | ||
return 'warning'; | ||
@@ -116,0 +115,0 @@ } |
@@ -60,2 +60,18 @@ "use strict"; | ||
exports.mkdir = mkdir; | ||
function writeFile(fileName, content) { | ||
return mkdir(path.dirname(fileName)) | ||
.then(function (_) { return fs.writeFile(fileName, content, 'utf8'); }); | ||
} | ||
exports.writeFile = writeFile; | ||
function countPathSep(fileName) { | ||
var count = 0; | ||
for (var _i = 0, fileName_1 = fileName; _i < fileName_1.length; _i++) { | ||
var ch = fileName_1[_i]; | ||
if (ch === path.sep) { | ||
count++; | ||
} | ||
} | ||
return count; | ||
} | ||
exports.countPathSep = countPathSep; | ||
//# sourceMappingURL=util.js.map |
Sorry, the diff of this file is not supported yet
522600
11692