From 62e7d131c9f94d6874d47fcc9b4c697ceed89720 Mon Sep 17 00:00:00 2001 From: Liliia Pelypenko <2556875+lpelypenko@users.noreply.github.com> Date: Thu, 22 Aug 2024 17:29:15 +0900 Subject: [PATCH] do not show an info message if user provided doNotCreateReportFile = true --- src/index.ts | 4 +--- test/index.test.ts | 5 ++++- 2 files changed, 5 insertions(+), 4 deletions(-) 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: {