lib/src/main.js
function prepare(reportData, opts) {
  // Stringify the data if needed
  let data = reportData;
  if (typeof data === 'object') {
    data = JSON.stringify(reportData);
  }

  // Get the options
  const reportOptions = getOptions(opts);

  // Stop here if we're not generating an HTML report
  if (!reportOptions.saveHtml) {
    return { reportOptions };
  }

  // Get the assets
  const assets = getAssets(reportOptions);

  // Render basic template to string
  // const { styles, scripts } = assets;

  const renderedHtml = render(React.createElement(MainHTML, {
    data,
    options: reportOptions,
    title: reportOptions.reportPageTitle,
    useInlineAssets: reportOptions.inlineAssets && !reportOptions.cdn,
    ...assets
  }));

  const html = `<!doctype html>\n${renderedHtml}`;
  return { html, reportOptions };
}
function prepare(reportData, opts) {
  // Stringify the data if needed
  let data = reportData;
  if (typeof data === 'object') {
    data = JSON.stringify(reportData);
  }

  // Get the options
  const reportOptions = getOptions(opts);

  // Stop here if we're not generating an HTML report
  if (!reportOptions.saveHtml) {
    return { reportOptions };
  }

  // Get the assets
  const assets = getAssets(reportOptions);

  // Render basic template to string
  // const { styles, scripts } = assets;

  const renderedHtml = render(React.createElement(MainHTML, {
    data,
    options: reportOptions,
    title: reportOptions.reportPageTitle,
    useInlineAssets: reportOptions.inlineAssets && !reportOptions.cdn,
    ...assets
  }));

  const html = `<!doctype html>\n${renderedHtml}`;
  return { html, reportOptions };
}
function prepare ( reportData , opts ) { // Stringify the data if needed let data = reportData ; if ( typeof data === 'object' ) { data = JSON . stringify ( reportData ) ; } // Get the options const reportOptions = getOptions ( opts ) ; // Stop here if we're not generating an HTML report if ( ! reportOptions . saveHtml ) { return { reportOptions } ; } // Get the assets const assets = getAssets ( reportOptions ) ; // Render basic template to string // const { styles, scripts } = assets; const renderedHtml = render ( React . createElement ( MainHTML , { data , options : reportOptions , title : reportOptions . reportPageTitle , useInlineAssets : reportOptions . inlineAssets && ! reportOptions . cdn , ... assets } ) ) ; const html = ` \n ${ renderedHtml } ` ; return { html , reportOptions } ; }
Prepare options, assets, and html for saving

@param {string} reportData JSON test data
@param {Object} opts Report options

@return {Object} Prepared data for saving
Prepare options assets and html for saving