diff --git a/README.MD b/README.MD index 4a44d1f2..a71ef5df 100644 --- a/README.MD +++ b/README.MD @@ -194,6 +194,12 @@ This expects the durations in the report to be in **nanoseconds**, which might r If set to `true` the duration of steps will be expected to be in **milliseconds**, which might result in incorrect durations when using a version of Cucumber(JS 1 or 4) that does report in **nanaseconds**. This parameter relies on `displayDuration: true` +### `useCDN` +- **Type:** `boolean` +- **Mandatory:** No + +If you prefer, you can use CDN for assets. + ### `customStyle` - **Type:** `path` - **Mandatory:** No diff --git a/lib/generate-report.js b/lib/generate-report.js index a1c07af2..051181ed 100755 --- a/lib/generate-report.js +++ b/lib/generate-report.js @@ -60,6 +60,7 @@ function generateReport(options) { const durationInMS = options.durationInMS || false; const pageTitle = options.pageTitle || 'Multiple Cucumber HTML Reporter'; const pageFooter = options.pageFooter || false; + const useCDN = options.useCDN || false; fs.ensureDirSync(reportPath); fs.ensureDirSync(path.resolve(reportPath, FEATURE_FOLDER)); @@ -72,6 +73,7 @@ function generateReport(options) { customData: customData, style: style, customStyle: customStyle, + useCDN: useCDN, displayDuration: displayDuration, browser: 0, name: '', @@ -483,6 +485,7 @@ function generateReport(options) { }), customStyle: _readTemplateFile(suite.customStyle), styles: _readTemplateFile(suite.style), + useCDN: suite.useCDN, genericScript: _readTemplateFile(GENERIC_JS), pageTitle: pageTitle, reportName: reportName, @@ -524,6 +527,7 @@ function generateReport(options) { scenarios: feature.elements, _: _ }), + useCDN: suite.useCDN, customStyle: _readTemplateFile(suite.customStyle), styles: _readTemplateFile(suite.style), genericScript: _readTemplateFile(GENERIC_JS), @@ -532,8 +536,8 @@ function generateReport(options) { pageFooter: pageFooter, }) ); - // Copy the assets, but first check if they don't exists - if (!fs.pathExistsSync(path.resolve(reportPath, 'assets'))) { + // Copy the assets, but first check if they don't exists and not useCDN + if (!fs.pathExistsSync(path.resolve(reportPath, 'assets')) && !suite.useCDN) { fs.copySync( path.resolve(path.dirname(require.resolve('../package.json')), 'templates/assets'), path.resolve(reportPath, 'assets') diff --git a/templates/feature-overview.index.tmpl b/templates/feature-overview.index.tmpl index 0da25605..9ccf512c 100644 --- a/templates/feature-overview.index.tmpl +++ b/templates/feature-overview.index.tmpl @@ -7,16 +7,34 @@