Skip to content

Commit

Permalink
misc(build): sample flow report (#12930)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamraine authored Aug 19, 2021
1 parent d51ebe7 commit 21eb8d3
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions build/build-sample-reports.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ const lhr = /** @type {LH.Result} */ (require('../lighthouse-core/test/results/s
const {LH_ROOT} = require('../root.js');
const htmlReportAssets = require('../lighthouse-core/../report/report-assets.js');

/** @type {LH.FlowResult} */
const flowResult = JSON.parse(
fs.readFileSync(
`${LH_ROOT}/lighthouse-core/test/fixtures/fraggle-rock/reports/sample-lhrs.json`,
'utf-8'
)
);

const DIST = path.join(LH_ROOT, 'dist');

Expand Down Expand Up @@ -53,8 +60,17 @@ const DIST = path.join(LH_ROOT, 'dist');
console.log('✅', filepath, 'written.');
}
});

generateFlowReport();
})();

function generateFlowReport() {
const html = ReportGenerator.generateFlowReportHtml(flowResult);
const filepath = `${DIST}/sample-reports/flow-report/index.html`;
fs.mkdirSync(path.dirname(filepath), {recursive: true});
fs.writeFileSync(filepath, html, {encoding: 'utf-8'});
console.log('✅', filepath, 'written.');
}

/**
* @return {string}
Expand Down

0 comments on commit 21eb8d3

Please sign in to comment.