Skip to content

Commit

Permalink
refactor: improves readability when generating the screenName
Browse files Browse the repository at this point in the history
  • Loading branch information
rmachado-studocu committed Sep 7, 2022
1 parent b6f1d59 commit 1227a81
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/classes/Crittr.class.js
Expand Up @@ -726,7 +726,8 @@ class Crittr {
if (this.options.takeScreenshots === true) {
let screenName = url.replace(/[^\w\s]/gi, '_') + '.png';
if (typeof this.options.screenshotNameGenerator === 'function') {
screenName = `${await this.options.screenshotNameGenerator(url)}.png`;
const screenGeneratedName = await this.options.screenshotNameGenerator(url);
screenName = `${screenGeneratedName}.png`;
}

await fs.mkdirp(this.options.screenshotPath);
Expand Down

0 comments on commit 1227a81

Please sign in to comment.