cucumber-html-reporter
Advanced tools
Comparing version 0.2.12 to 0.2.13
@@ -39,2 +39,3 @@ 'use strict'; | ||
failed: 0, | ||
totalTime: 0, | ||
scenarios: { | ||
@@ -56,2 +57,19 @@ passed: 0, | ||
var calculateDuration = function(duration) { | ||
var oneNanoSecond = 1000000000; | ||
var oneMinute = 60 * oneNanoSecond; | ||
duration = parseInt(duration); | ||
function format(min, sec) { | ||
sec = sec + 's'; | ||
return min > 0 ? min + 'm ' + sec : sec; | ||
} | ||
if (!isNaN(duration)) { | ||
var min = Math.trunc(duration / oneMinute); | ||
var sec = _.round((duration % oneMinute) / oneNanoSecond); | ||
return format(min, sec); | ||
} | ||
}; | ||
var setStats = function(suite) { | ||
@@ -72,2 +90,3 @@ var featureOutput = suite.features; | ||
feature.scenarios.pending = 0; | ||
feature.time = 0; | ||
featuresSummary.isFailed = false; | ||
@@ -85,2 +104,3 @@ | ||
element.pending = 0; | ||
element.time = 0; | ||
@@ -113,2 +133,5 @@ element.steps.forEach(function(step) { | ||
} | ||
if (step.result.duration) { | ||
element.time += step.result.duration; | ||
} | ||
if (step.result.status === result.status.passed) { | ||
@@ -130,2 +153,6 @@ return element.passed++; | ||
if (element.time > 0) { | ||
feature.time += element.time; | ||
} | ||
if (element.notdefined > 0) { | ||
@@ -172,2 +199,6 @@ feature.scenarios.notdefined++; | ||
if (feature.time) { | ||
suite.totalTime += feature.time | ||
} | ||
return suite; | ||
@@ -177,2 +208,4 @@ | ||
suite.totalTime = calculateDuration(suite.totalTime); | ||
suite.features = featureOutput; | ||
@@ -204,3 +237,4 @@ | ||
suite: suite, | ||
_: _ | ||
_: _, | ||
calculateDuration: calculateDuration | ||
}), | ||
@@ -240,3 +274,3 @@ styles: readFile('style.css'), | ||
if(options.jsonDir) { | ||
if (options.jsonDir) { | ||
jsonDir.collectJSONS(options) | ||
@@ -243,0 +277,0 @@ } |
{ | ||
"name": "cucumber-html-reporter", | ||
"version": "0.2.12", | ||
"version": "0.2.13", | ||
"description": "Generates Cucumber HTML reports in three different themes", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -18,3 +18,3 @@ 'use strict'; | ||
this.Given(/^Fred runs a passing cucumber scenario on behalf of "([^"]*)"/, function(name, callback) { | ||
callback(); | ||
setTimeout(callback, 2000); | ||
}); | ||
@@ -21,0 +21,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
348156
1694