cucumber-html-reporter
Advanced tools
Comparing version 5.2.0 to 5.3.0
interface Options { | ||
theme: string, | ||
jsonFile: string, | ||
theme: 'bootstrap' | 'hierarchy' | 'foundation' | 'simple', | ||
jsonFile?: string, | ||
jsonDir?: string, | ||
@@ -14,2 +14,4 @@ output: string, | ||
name?: string, | ||
brandTitle?: string, | ||
scenarioTimestamp?: boolean, | ||
metadata?: { | ||
@@ -20,2 +22,2 @@ [key: string]: string | ||
export function generate(options: Options, callback?: () => void): void | ||
export function generate(options: Options, callback?: () => void): void |
@@ -81,2 +81,3 @@ 'use strict'; | ||
ambiguous: 0, | ||
skipped: 0, | ||
parent: parent, | ||
@@ -115,3 +116,3 @@ features: [], | ||
* @param subSuite | ||
* @param attrName ('passed', 'failed', or 'ambiguous') | ||
* @param attrName ('passed', 'failed', 'ambiguous', or 'skipped') | ||
*/ | ||
@@ -118,0 +119,0 @@ var recursivelyIncrementStat = function (subSuite, attrName) { |
@@ -51,5 +51,7 @@ 'use strict'; | ||
jsonOutput.map(addTimestamp); | ||
jsonOutput.sort(function (feature, nextFeature) { | ||
return feature.timestamp - nextFeature.timestamp; | ||
}); | ||
if (!jsonOutput.filter(f => !f.timestamp).length) { | ||
jsonOutput.sort(function (feature, nextFeature) { | ||
return feature.timestamp - nextFeature.timestamp; | ||
}); | ||
} | ||
@@ -56,0 +58,0 @@ jsonFile.writeFileSync(options.output + '.json', jsonOutput, {spaces: 2}); |
@@ -29,8 +29,8 @@ 'use strict'; | ||
var sanitize = function (name, find) { | ||
var unsafeCharacters = find || /[/\|:"*?<>]/g; | ||
if (name !== undefined) { | ||
name = name.trim().replace(unsafeCharacters, '_'); | ||
} | ||
return name; | ||
}; | ||
var unsafeCharacters = find || /[/\|:"*?<>]/g; | ||
if (name !== undefined) { | ||
name = name.trim().replace(unsafeCharacters, '_'); | ||
} | ||
return name; | ||
}; | ||
@@ -276,7 +276,21 @@ featureOutput.summary = { | ||
} | ||
} else if (embeddingType === 'image/gif') { | ||
step.image = 'data:image/gif;base64,' + embedding.data; | ||
if (options.storeScreenshots && options.storeScreenshots === true) { | ||
var name = sanitize(step.name || step.keyword, /[^a-zA-Z0-9-]+/g); // Only allow URL-friendly file names | ||
if (!fs.existsSync(screenshotsDirectory)) { | ||
fs.mkdirSync(screenshotsDirectory); | ||
} | ||
name = name + '_' + Math.round(Math.random() * 10000) + '.gif'; //randomize the file name | ||
var filename = path.join(screenshotsDirectory, name); | ||
fs.writeFileSync(filename, embedding.data, 'base64'); | ||
if (options.noInlineScreenshots) step.image = path.relative(path.join(options.output, '..'), filename); | ||
} | ||
} else { | ||
var file = 'data:application/octet-stream;base64,' + embedding.data; | ||
var fileType = embedding.mime_type.split('/')[1]; | ||
step.text = step.text || ''; | ||
step.text = step.text.concat('<a href="'+file+'" download="file.'+fileType+'">download file</a>'); | ||
var file = 'data:application/octet-stream;base64,' + embedding.data; | ||
var fileType = embedding.mime_type.split('/')[1]; | ||
step.text = step.text || ''; | ||
step.text = step.text.concat('<a href="'+file+'" download="file.'+fileType+'">download file</a>'); | ||
} | ||
@@ -302,14 +316,14 @@ }); | ||
switch (step.result.status) { | ||
case result.status.passed: | ||
return element.passed++; | ||
case result.status.failed: | ||
return element.failed++; | ||
case result.status.undefined: | ||
return element.notdefined++; | ||
case result.status.pending: | ||
return element.pending++; | ||
case result.status.ambiguous: | ||
return element.ambiguous++; | ||
default: | ||
break; | ||
case result.status.passed: | ||
return element.passed++; | ||
case result.status.failed: | ||
return element.failed++; | ||
case result.status.undefined: | ||
return element.notdefined++; | ||
case result.status.pending: | ||
return element.pending++; | ||
case result.status.ambiguous: | ||
return element.ambiguous++; | ||
default: | ||
break; | ||
} | ||
@@ -394,2 +408,3 @@ | ||
suite.ambiguous = suite.scenarios.ambiguous; | ||
suite.skipped = suite.scenarios.skipped; | ||
suite.reportAs = 'scenarios'; | ||
@@ -448,3 +463,3 @@ } | ||
console.log('\n' + | ||
console.log('\n' + | ||
chalk.green.bold(emoji.emojify(':rocket:') + ' Cucumber HTML report ' + chalk.blue.bold(options.output) + ' generated successfully ') + | ||
@@ -460,3 +475,3 @@ emoji.emojify(':thumbsup:') | ||
options.jsonFile = options.jsonFile || options.output + '.json'; | ||
function isAFile(filePath) { | ||
@@ -469,3 +484,3 @@ try { | ||
} | ||
if(!isAFile(options.jsonFile)) { | ||
@@ -475,3 +490,3 @@ var jsonFilePath = options.jsonFile; | ||
options.jsonFile = jsonFilePath + "/" + dynamicReportJsonFileName[0]; | ||
} | ||
} | ||
@@ -482,3 +497,3 @@ try { | ||
} catch (e) { | ||
console.log('\n' + | ||
console.log('\n' + | ||
chalk.bold.red(emoji.emojify(':warning: ') + emoji.emojify(':disappointed: ') + 'Unable to parse cucumberjs output into json: \'%s\'', options.jsonFile, e) | ||
@@ -494,3 +509,3 @@ ); | ||
async function launchReport() { | ||
async function launchReport() { | ||
if (fs.existsSync(options.output) && (options.launchReport || options.launchReport === 'true')) { | ||
@@ -497,0 +512,0 @@ await open(options.output, {wait: false}); |
{ | ||
"name": "cucumber-html-reporter", | ||
"version": "5.2.0", | ||
"version": "5.3.0", | ||
"description": "Generates Cucumber HTML reports in three different themes", | ||
@@ -131,2 +131,14 @@ "main": "index.js", | ||
"url": "https://github.com/ErikGrigoriev" | ||
}, | ||
{ | ||
"name": "roland-vachter", | ||
"url": "https://github.com/roland-vachter" | ||
}, | ||
{ | ||
"name": "sv3k", | ||
"url": "https://github.com/sv3k" | ||
}, | ||
{ | ||
"name": "Fabienmrqs ", | ||
"url": "https://github.com/Fabienmrqs" | ||
} | ||
@@ -133,0 +145,0 @@ ], |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 2 instances in 1 package
2592
0
1976387
49