Skip to content

Commit

Permalink
fix: lint issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Ma11hewThomas committed Jul 4, 2024
1 parent 16f34e5 commit e2baad9
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/generate-report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,19 @@ class GenerateCtrfReport extends WDIOReporter {
}

onRunnerEnd(runner: RunnerStats): void {
this.ctrfReport.results.summary.stop = Date.now()
this.ctrfReport.results.summary.stop = Date.now()
const specFilePath = runner.specs[0]
const pathParts = path.normalize(specFilePath).split(path.sep)
const uniqueIdentifier = pathParts
.slice(-2)
.join('-')
.replace(/\.(js|ts)$/, '')

const sanitizedUniqueIdentifier = uniqueIdentifier.replace(/[<>:"/\\|?*\x00-\x1F]/g, '');
.slice(-2)
.join('-')
.replace(/\.(js|ts)$/, '')

const sanitizedUniqueIdentifier = uniqueIdentifier.replace(
// eslint-disable-next-line no-control-regex
/[<>:"/\\|?*\x00-\x1F]/g,
''
)
const timestamp = new Date().toISOString().replace(/[:.]/g, '-')
this.reporterConfigOptions.outputFile = `ctrf-report-${sanitizedUniqueIdentifier}-${timestamp}.json`
this.writeReportToFile(this.ctrfReport)
Expand Down

0 comments on commit e2baad9

Please sign in to comment.