Skip to content

Commit 26d2676

Browse files
committed
moved the init of regex out of recursive function
1 parent a229893 commit 26d2676

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

visual-report.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const fs = require('fs');
22
const path = require('path');
3+
const SLASH_REGEX = /\//g;
34

45
async function generateVisualReport() {
56
const expectedDir = path.join(process.cwd(), 'test/unit/visual/screenshots');
@@ -82,7 +83,7 @@ async function generateVisualReport() {
8283
};
8384

8485
// Create flattened name for lookup
85-
const flattenedName = testDir.replace(/\//g, '-');
86+
const flattenedName = testDir.replace(SLASH_REGEX, '-');
8687

8788
// Collect all screenshots for this test
8889
for (let i = 0; i < test.numScreenshots; i++) {

0 commit comments

Comments
 (0)