lib/generate-report.js
function _createFeatureIndexPages(suite) {

    // Set custom metadata overview for the feature
    FEATURE_METADATA_OVERVIEW_TEMPLATE = suite.customMetadata ?
      FEATURE_CUSTOM_METADATA_OVERVIEW_TEMPLATE : FEATURE_METADATA_OVERVIEW_TEMPLATE;

    suite.features.forEach(feature => {
      const featurePage = path.resolve(reportPath, `${FEATURE_FOLDER}/${feature.id}.html`);
      fs.writeFileSync(
        featurePage,
        _.template(_readTemplateFile(FEATURE_OVERVIEW_INDEX_TEMPLATE))({
          feature: feature,
          featureScenariosOverviewChart: _.template(_readTemplateFile(SCENARIOS_OVERVIEW_CHART_TEMPLATE))({
            overviewPage: false,
            feature: feature,
            suite: suite,
            scenarios: feature.scenarios,
            _: _
          }),
          featureMetadataOverview: _.template(_readTemplateFile(FEATURE_METADATA_OVERVIEW_TEMPLATE))({
            metadata: feature.metadata,
            _: _
          }),
          scenarioTemplate: _.template(_readTemplateFile(SCENARIOS_TEMPLATE))({
            suite: suite,
            scenarios: feature.elements,
            _: _
          }),
          customStyle: _readTemplateFile(suite.customStyle),
          styles: _readTemplateFile(suite.style),
          genericScript: _readTemplateFile(GENERIC_JS),
          pageTitle: pageTitle,
          reportName: reportName,
          pageFooter: pageFooter,
        })
      );
      // Copy the assets
      fs.copySync(
        path.resolve(path.dirname(require.resolve("../package.json")),'templates/assets'),
        path.resolve(reportPath, 'assets')
      );
    });
  }
function _createFeatureIndexPages(suite) {

    // Set custom metadata overview for the feature
    FEATURE_METADATA_OVERVIEW_TEMPLATE = suite.customMetadata ?
      FEATURE_CUSTOM_METADATA_OVERVIEW_TEMPLATE : FEATURE_METADATA_OVERVIEW_TEMPLATE;

    suite.features.forEach(feature => {
      const featurePage = path.resolve(reportPath, `${FEATURE_FOLDER}/${feature.id}.html`);
      fs.writeFileSync(
        featurePage,
        _.template(_readTemplateFile(FEATURE_OVERVIEW_INDEX_TEMPLATE))({
          feature: feature,
          featureScenariosOverviewChart: _.template(_readTemplateFile(SCENARIOS_OVERVIEW_CHART_TEMPLATE))({
            overviewPage: false,
            feature: feature,
            suite: suite,
            scenarios: feature.scenarios,
            _: _
          }),
          featureMetadataOverview: _.template(_readTemplateFile(FEATURE_METADATA_OVERVIEW_TEMPLATE))({
            metadata: feature.metadata,
            _: _
          }),
          scenarioTemplate: _.template(_readTemplateFile(SCENARIOS_TEMPLATE))({
            suite: suite,
            scenarios: feature.elements,
            _: _
          }),
          customStyle: _readTemplateFile(suite.customStyle),
          styles: _readTemplateFile(suite.style),
          genericScript: _readTemplateFile(GENERIC_JS),
          pageTitle: pageTitle,
          reportName: reportName,
          pageFooter: pageFooter,
        })
      );
      // Copy the assets
      fs.copySync(
        path.resolve(path.dirname(require.resolve("../package.json")),'templates/assets'),
        path.resolve(reportPath, 'assets')
      );
    });
  }
function _createFeatureIndexPages ( suite ) { // Set custom metadata overview for the feature FEATURE_METADATA_OVERVIEW_TEMPLATE = suite . customMetadata ? FEATURE_CUSTOM_METADATA_OVERVIEW_TEMPLATE : FEATURE_METADATA_OVERVIEW_TEMPLATE ; suite . features . forEach ( feature => { const featurePage = path . resolve ( reportPath , ` ${ FEATURE_FOLDER } ${ feature . id } ` ) ; fs . writeFileSync ( featurePage , _ . template ( _readTemplateFile ( FEATURE_OVERVIEW_INDEX_TEMPLATE ) ) ( { feature : feature , featureScenariosOverviewChart : _ . template ( _readTemplateFile ( SCENARIOS_OVERVIEW_CHART_TEMPLATE ) ) ( { overviewPage : false , feature : feature , suite : suite , scenarios : feature . scenarios , _ : _ } ) , featureMetadataOverview : _ . template ( _readTemplateFile ( FEATURE_METADATA_OVERVIEW_TEMPLATE ) ) ( { metadata : feature . metadata , _ : _ } ) , scenarioTemplate : _ . template ( _readTemplateFile ( SCENARIOS_TEMPLATE ) ) ( { suite : suite , scenarios : feature . elements , _ : _ } ) , customStyle : _readTemplateFile ( suite . customStyle ) , styles : _readTemplateFile ( suite . style ) , genericScript : _readTemplateFile ( GENERIC_JS ) , pageTitle : pageTitle , reportName : reportName , pageFooter : pageFooter , } ) ) ; // Copy the assets fs . copySync ( path . resolve ( path . dirname ( require . resolve ( "../package.json" ) ) , 'templates/assets' ) , path . resolve ( reportPath , 'assets' ) ) ; } ) ; }
Generate the feature pages
@param suite suite JSON object with all the features and scenarios
@private
Generate the feature pages