Skip to content

Commit 92594ac

Browse files
committed
moving time multiplier to config option
1 parent 62ec9f7 commit 92594ac

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ plugins: {
3535
outputFile: 'file.json', // cucumber_output.json by default
3636
uniqueFileNames: false, // if true outputFile is ignored in favor of unique file names in the format of `cucumber_output_<UUID>.json`. Useful for parallel test execution
3737
includeExampleValues: false // if true incorporate actual values from Examples table along with variable placeholder when writing steps to the report
38+
timeMultiplier: 1000000, // Used when calculating duration of individual BDD steps. Defaults to nanoseconds
39+
};
3840
},
3941
}
4042
...

index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const defaultConfig = {
2121
outputFile: 'cucumber_output.json',
2222
uniqueFileNames: false,
2323
includeExampleValues: false,
24+
timeMultiplier: 1000000, // nanoseconds
2425
};
2526

2627
module.exports = function (config) {
@@ -105,7 +106,7 @@ module.exports = function (config) {
105106
if (report && report.step) {
106107
report.step.end_time = Date.now();
107108
// calculate the duration in nanoseconds for cucumber-html-reporter
108-
report.step.result.duration = (report.step.end_time - report.step.start_time) * 1000000;
109+
report.step.result.duration = (report.step.end_time - report.step.start_time) * config.timeMultiplier;
109110
}
110111
});
111112
});
@@ -333,7 +334,7 @@ module.exports = function (config) {
333334
return rootStep;
334335
}
335336

336-
// Checks if step is actually BDD
337+
// Checks if step is actually BDDconfig.includeExampleValues
337338
// Before-After Hooks aren't BDD and we want to exclude those from reporting pass/fail
338339
function isBDD(step) {
339340
const metaStep = getRootMetaStep(step);

0 commit comments

Comments
 (0)