lib/src/main.js
function create(data, opts) {
  const { html, reportOptions } = prepare(data, opts);
  const {
    saveJson,
    saveHtml,
    autoOpen,
    overwrite,
    jsonFile,
    htmlFile
  } = reportOptions;

  const savePromises = [];

  savePromises.push(saveHtml !== false
    ? saveFile(htmlFile, html, overwrite)
      .then(savedHtml => (autoOpen && openFile(savedHtml)) || savedHtml)
    : null);

  savePromises.push(saveJson
    ? saveFile(jsonFile, JSON.stringify(data, null, 2), overwrite)
    : null);

  return Promise.all(savePromises);
}
function create(data, opts) {
  const { html, reportOptions } = prepare(data, opts);
  const {
    saveJson,
    saveHtml,
    autoOpen,
    overwrite,
    jsonFile,
    htmlFile
  } = reportOptions;

  const savePromises = [];

  savePromises.push(saveHtml !== false
    ? saveFile(htmlFile, html, overwrite)
      .then(savedHtml => (autoOpen && openFile(savedHtml)) || savedHtml)
    : null);

  savePromises.push(saveJson
    ? saveFile(jsonFile, JSON.stringify(data, null, 2), overwrite)
    : null);

  return Promise.all(savePromises);
}
function create ( data , opts ) { const { html , reportOptions } = prepare ( data , opts ) ; const { saveJson , saveHtml , autoOpen , overwrite , jsonFile , htmlFile } = reportOptions ; const savePromises = [ ] ; savePromises . push ( saveHtml !== false ? saveFile ( htmlFile , html , overwrite ) . then ( savedHtml => ( autoOpen && openFile ( savedHtml ) ) || savedHtml ) : null ) ; savePromises . push ( saveJson ? saveFile ( jsonFile , JSON . stringify ( data , null , 2 ) , overwrite ) : null ) ; return Promise . all ( savePromises ) ; }
Create the report

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

@return {Promise} Resolves if report was created successfully
Create the report