* Modify the test status of the JSONP report based on the approved file name. JSONP is used * to create the Backstop report in browser. This function ensures the UI consistency after * a user apporves a test in browser and refreshes the report without running a test. * * @param {Object} params -
({ reportConfigFilename, approvedFileName })
| 44 | * @return {Promise} |
| 45 | */ |
| 46 | async function modifyJsonpReport ({ reportConfigFilename, approvedFileName }) { |
| 47 | return fs |
| 48 | .readFile(reportConfigFilename, 'utf8') |
| 49 | .then(content => { |
| 50 | const jsonpReport = modifyJsonpReportHelper(content[0], approvedFileName); |
| 51 | return fs.writeFile(reportConfigFilename, jsonpReport); |
| 52 | }) |
| 53 | .catch(err => { |
| 54 | throw new Error(`Failed to modify the report. ${err.message}.`); |
| 55 | }); |
| 56 | } |
| 57 | |
| 58 | module.exports = { |
| 59 | modifyJsonpReport, |
no test coverage detected