diff --git a/src/index.ts b/src/index.ts index 29a9117..564cb86 100644 --- a/src/index.ts +++ b/src/index.ts @@ -59,9 +59,7 @@ export function createHtmlReport({ results, options }: CreateReport): string { hasAxeRawResults: Boolean(results?.timestamp), rules: prepareAxeRules(results?.toolOptions?.rules || {}), }); - if (options?.doNotCreateReportFile === true) { - console.info('Report file will not be created because user passed options.doNotCreateReportFile = true. Use HTML output of the function to create report file'); - } else { + if (!options || options.doNotCreateReportFile === undefined || !options.doNotCreateReportFile) { saveHtmlReport({ htmlContent, reportFileName: options?.reportFileName, diff --git a/test/index.test.ts b/test/index.test.ts index a0e39ca..d5e1599 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -280,7 +280,10 @@ describe('Successful tests', () => {
  • Open https://dequeuniversity.com/demo/mars/
  • Analyze full page with all rules enabled
  • `; - + const reportFileName = 'shouldNotBeSaved.html'; + fs.rmSync(getPathToCreatedReport(reportFileName), { + force: true, + }); const reportHTML = createHtmlReport({ results: rawAxeResults, options: {