forked from usebruno/bruno
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(usebruno#1659): Improve report options to enable anonymization
- Loading branch information
Showing
4 changed files
with
183 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
const makeHtmlOutput = async (results, outputPath) => { | ||
const makeHtmlOutput = async (results, outputPath, templatePath, title) => { | ||
const resultsJson = JSON.stringify(results, null, 2); | ||
|
||
const reportPath = path.join(__dirname, 'html-template.html'); | ||
const reportPath = templatePath || path.join(__dirname, 'html-template.html'); | ||
const template = fs.readFileSync(reportPath, 'utf8'); | ||
|
||
fs.writeFileSync(outputPath, template.replace('__RESULTS_JSON__', resultsJson)); | ||
fs.writeFileSync(outputPath, template.replace('__RESULTS_JSON__', resultsJson).replaceAll('__TITLE__', title)); | ||
}; | ||
|
||
module.exports = makeHtmlOutput; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters