New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

multiple-cucumber-html-reporter

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

multiple-cucumber-html-reporter - npm Package Compare versions

Comparing version

to
1.20.1

templates/assets/js/Chart.style.js

6

lib/collect-jsons.js

@@ -61,7 +61,7 @@ 'use strict';

// Only check the feature hooks if there are elements (fail safe)
// Only check the feature hooks if there are elements (fail-safe)
const {elements} = json;
if (elements) {
const scenarios = elements.map(scenario => {
json.elements = elements.map(scenario => {
const {before, after} = scenario;

@@ -78,4 +78,2 @@

})
json.elements = scenarios
}

@@ -82,0 +80,0 @@

@@ -52,17 +52,18 @@ 'use strict';

const customData = options.customData || null;
const plainDescription = !!options.plainDescription;
const style = options.overrideStyle || REPORT_STYLESHEET;
const customStyle = options.customStyle;
const disableLog = options.disableLog;
const openReportInBrowser = options.openReportInBrowser;
const disableLog = !!options.disableLog;
const openReportInBrowser = !!options.openReportInBrowser;
const reportName = options.reportName || DEFAULT_REPORT_NAME;
const reportPath = path.resolve(process.cwd(), options.reportPath);
const saveCollectedJSON = options.saveCollectedJSON;
const displayDuration = options.displayDuration || false;
const displayReportTime = options.displayReportTime || false;
const durationInMS = options.durationInMS || false;
const hideMetadata = options.hideMetadata || false;
const saveCollectedJSON = !!options.saveCollectedJSON;
const displayDuration = !!options.displayDuration;
const displayReportTime = !!options.displayReportTime;
const durationInMS = !!options.durationInMS;
const hideMetadata = !!options.hideMetadata;
const pageTitle = options.pageTitle || 'Multiple Cucumber HTML Reporter';
const pageFooter = options.pageFooter || false;
const useCDN = options.useCDN || false;
const staticFilePath = options.staticFilePath || false;
const pageFooter = !!options.pageFooter;
const useCDN = !!options.useCDN;
const staticFilePath = !!options.staticFilePath;

@@ -99,3 +100,3 @@ fs.ensureDirSync(reportPath);

failedPercentage: 0,
notdefinedPercentage: 0,
notDefinedPercentage: 0,
pendingPercentage: 0,

@@ -123,3 +124,3 @@ skippedPercentage: 0,

suite.featureCount.failedPercentage = _calculatePercentage(suite.featureCount.failed, suite.featureCount.total);
suite.featureCount.notdefinedPercentage = _calculatePercentage(suite.featureCount.notDefined, suite.featureCount.total);
suite.featureCount.notDefinedPercentage = _calculatePercentage(suite.featureCount.notDefined, suite.featureCount.total);
suite.featureCount.pendingPercentage = _calculatePercentage(suite.featureCount.pending, suite.featureCount.total);

@@ -174,3 +175,3 @@ suite.featureCount.skippedPercentage = _calculatePercentage(suite.featureCount.skipped, suite.featureCount.total);

failedPercentage: 0,
notdefinedPercentage: 0,
notDefinedPercentage: 0,
skippedPercentage: 0,

@@ -189,3 +190,3 @@ pendingPercentage: 0,

suite.featureCount.total++;
var idPrefix = staticFilePath ? '' : `${ uuid() }.` ;
const idPrefix = staticFilePath ? '' : `${ uuid() }.` ;
feature.id = `${ idPrefix }${ feature.id }`.replace(/[^a-zA-Z0-9-_]/g, '-');

@@ -233,3 +234,3 @@ feature.app = 0;

feature.scenarios.failedPercentage = _calculatePercentage(feature.scenarios.failed, feature.scenarios.total);
feature.scenarios.notdefinedPercentage = _calculatePercentage(feature.scenarios.notDefined, feature.scenarios.total);
feature.scenarios.notDefinedPercentage = _calculatePercentage(feature.scenarios.notDefined, feature.scenarios.total);
feature.scenarios.passedPercentage = _calculatePercentage(feature.scenarios.passed, feature.scenarios.total);

@@ -240,3 +241,3 @@ feature.scenarios.pendingPercentage = _calculatePercentage(feature.scenarios.pending, feature.scenarios.total);

suite.scenarios.failedPercentage = _calculatePercentage(suite.scenarios.failed, suite.scenarios.total);
suite.scenarios.notdefinedPercentage = _calculatePercentage(suite.scenarios.notDefined, suite.scenarios.total);
suite.scenarios.notDefinedPercentage = _calculatePercentage(suite.scenarios.notDefined, suite.scenarios.total);
suite.scenarios.passedPercentage = _calculatePercentage(suite.scenarios.passed, suite.scenarios.total);

@@ -342,4 +343,2 @@ suite.scenarios.pendingPercentage = _calculatePercentage(suite.scenarios.pending, suite.scenarios.total);

if (step.embeddings !== undefined) {
const Base64 = require('js-base64').Base64;
step.attachments = [];

@@ -351,10 +350,5 @@ step.embeddings.forEach((embedding, embeddingIndex) => {

} else if (embedding.mime_type === 'text/html' || (embedding.media && embedding.media.type === 'text/html')) {
step.html = (step.html ? step.html : []).concat([
_isBase64(embedding.data) ? Base64.decode(embedding.data) :
embedding.data
]);
step.html = (step.html ? step.html : []).concat([embedding.data]);
} else if (embedding.mime_type === 'text/plain' || (embedding.media && embedding.media.type === 'text/plain')) {
step.text = (step.text ? step.text : []).concat([
_isBase64(embedding.data) ? _escapeHtml(Base64.decode(embedding.data)) : _escapeHtml(embedding.data)
]);
step.text = (step.text ? step.text : []).concat([_escapeHtml(embedding.data)]);
} else if (embedding.mime_type === 'image/png' || (embedding.media && embedding.media.type === 'image/png')) {

@@ -364,11 +358,11 @@ step.image = (step.image ? step.image : []).concat([ 'data:image/png;base64,' + embedding.data ]);

} else {
let embeddingtype = 'text/plain';
let embeddingType = 'text/plain';
if (embedding.mime_type) {
embeddingtype = embedding.mime_type;
embeddingType = embedding.mime_type;
} else if (embedding.media && embedding.media.type) {
embeddingtype = embedding.media.type;
embeddingType = embedding.media.type;
}
step.attachments.push({
data: 'data:' + embeddingtype + ';base64,' + embedding.data,
type: embeddingtype
data: 'data:' + embeddingType + ';base64,' + embedding.data,
type: embeddingType
});

@@ -380,6 +374,6 @@ step.embeddings[ embeddingIndex ] = {};

if (step.doc_string !== undefined) {
step.id = `${uuid()}.${scenario.id}.${step.name}`.replace(/[^a-zA-Z0-9-_]/g, '-');
step.restWireData = _escapeHtml(step.doc_string.value).replace(new RegExp('\r?\n', 'g'), '<br />');
}
if (step.doc_string !== undefined) {
step.id = `${uuid()}.${scenario.id}.${step.name}`.replace(/[^a-zA-Z0-9-_]/g, '-');
step.restWireData = _escapeHtml(step.doc_string.value).replace(new RegExp('\r?\n', 'g'), '<br />');
}

@@ -445,23 +439,2 @@ if (!step.result

/**
* Check if the string a base64 string
* @param string
* @return {boolean}
* @private
*/
function _isBase64(string) {
const notBase64 = /[^A-Z0-9+\/=]/i;
const stringLength = string.length;
if (!stringLength || stringLength % 4 !== 0 || notBase64.test(string)) {
return false;
}
const firstPaddingChar = string.indexOf('=');
return firstPaddingChar === -1 ||
firstPaddingChar === stringLength - 1 ||
(firstPaddingChar === stringLength - 2 && string[ stringLength - 1 ] === '=');
}
/**
* Escape html in string

@@ -568,5 +541,6 @@ * @param string

pageFooter: pageFooter,
plainDescription: plainDescription
})
);
// Copy the assets, but first check if they don't exists and not useCDN
// Copy the assets, but first check if they don't exist and not useCDN
if (!fs.pathExistsSync(path.resolve(reportPath, 'assets')) && !suite.useCDN) {

@@ -573,0 +547,0 @@ fs.copySync(

{
"name": "multiple-cucumber-html-reporter",
"version": "1.20.0",
"version": "1.20.1",
"description": "Generate beautifull cucumberjs reports for multiple instances (browsers / devices)",

@@ -38,3 +38,2 @@ "keywords": [

"fs-extra": "^8.1.0",
"js-base64": "^2.5.1",
"jsonfile": "^5.0.0",

@@ -41,0 +40,0 @@ "lodash": "^4.17.19",

@@ -116,2 +116,3 @@ Multiple Cucumber HTML Reporter

- **Type:** `boolean`
- **Default:** `false`
- **Mandatory:** No

@@ -123,2 +124,3 @@

- **Type:** `boolean`
- **Default:** `false`
- **Mandatory:** No

@@ -130,2 +132,3 @@

- **Type:** `boolean`
- **Default:** `false`
- **Mandatory:** No

@@ -140,4 +143,4 @@

- **Type:** `boolean`
- **Default:** `false`
- **Mandatory:** No
- **Default:** `false`

@@ -172,4 +175,24 @@ This will disable the log so will **NOT** see this.

### `plainDescription`
- **Type:** `boolean`
- **Default:** `false`
- **Mandatory:** No
The feature description is assumed to be a simple string and the library formats it accordingly, by copying it inside a
paragraph tag. Since the description can be any free text, it can also be as complex as a full `div`, e.g.:
```html
<div>
<p><strong>Test description </strong> : The test implements comparisons using all our datatypes</p>
<p><strong>Expected result </strong> : Device does not reset</p>
<p><strong>Feature type </strong> : Robustness</p>
<p><strong>Comments </strong> : Test covers comparison operators</p>
</div>
```
If the description already include formatting tags you can include it _as is_ by setting `plainDescription` to `true`.
### `displayDuration`
- **Type:** `boolean`
- **Default:** `false`
- **Mandatory:** No

@@ -206,2 +229,3 @@

- **Type:** `boolean`
- **Default:** `false`
- **Mandatory:** No

@@ -215,4 +239,25 @@

If you need add some custom style to your report. Add it like this `customStyle: 'your-path-where/custom.css'`
If you need to add some custom style to your report. Add it like this `customStyle: 'your-path-where/custom.css'`
Customization is now possible also for the doughnut chart by using [CSS variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties).
The user can define colors for the chart by defining variables for the different categories as follows:
```css
:root {
--ambiguous-color:#AAAAAA;
--failed-color:#BBBBBB;
--not-defined-color:#CCCCCC;
--passed-color:#DDDDDD;
--pending-color:#EEEEEE;
--skipped-color:#FFFFFF;
}
```
Please note that these colors do _not_ affect the main colors CSS. To have homogeneous styling you can simply link those
colors to the variables, e.g.:
```css
.ambiguous-color {
color: var(--ambiguous-color) !important;
}
```
Please refer to the `test` directory and the `embedded-array` test report for a complete color customization example.
### `overrideStyle`

@@ -222,5 +267,5 @@ - **Type:** `path`

If you need replace default style for your report. Add it like this `overrideStyle: 'your-path-where/custom.css'`
If you need to replace completely the default style for your report. Add it like this `overrideStyle: 'your-path-where/custom.css'`
Please refer to the `test` directory for an example.
### `metadata`

@@ -253,2 +298,3 @@ - **Type:** `JSON`

- **Type:** `boolean`
- **Default:** `false`
- **Mandatory:** No

@@ -432,3 +478,3 @@

> Check the framework you are using to attach plain text to the JSON file.
> Check the framework you are using to attach plain text to the JSON file. Please make sure to convert binary/non-readable data to a suitable textual representation, e.g. via Base64 encoding.

@@ -435,0 +481,0 @@ ### How to attach pretty JSON to HTML report

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

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