Skip to content

Commit

Permalink
feat(report): improve job dump by transforming RegExps
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudBuchholz committed Mar 23, 2023
1 parent bafc0e5 commit 9b7b26e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ const { fork } = require('child_process')
const { getOutput } = require('./output')

async function serialize (job, filename, json) {
await writeFile(join(job.reportDir, `${filename}.js`), `module.exports = ${JSON.stringify(json, undefined, 2)}`)
await writeFile(join(job.reportDir, `${filename}.js`), `module.exports = ${JSON.stringify(json, (key, value) => {
if (value && value instanceof RegExp) {
return value.toString()
}
return value
}, 2)}`)
}

async function save (job) {
Expand Down

0 comments on commit 9b7b26e

Please sign in to comment.