Skip to content

Commit

Permalink
fix: normalize spec name and e2e spec dir to fix cross OS issue
Browse files Browse the repository at this point in the history
  • Loading branch information
AtoianAvetik authored and simonsmith committed Sep 13, 2023
1 parent c07da67 commit 23b9083
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const runImageDiffAfterScreenshot = async (
screenshotConfig.path
// remove the screenshots path and just leave folders to be created in
// the snapshots folder
.replace(screenshotConfig.specName, '')
.replace(path.normalize(screenshotConfig.specName), '')
// remove specName here because in run mode it's added and duplicated.
// In open mode it's an empty string so is ignored
.replace(screenshotsFolder, ''),
Expand All @@ -85,7 +85,10 @@ const runImageDiffAfterScreenshot = async (
log('snapshotName', snapshotName)
log('screenshotConfig', screenshotConfig)

const specDestination = specFileRelativeToRoot.replace(e2eSpecDir, '')
const specDestination = specFileRelativeToRoot.replace(
path.normalize(e2eSpecDir),
'',
)

const snapshotsDir = customSnapshotsDir
? path.join(process.cwd(), customSnapshotsDir, specDestination)
Expand Down

0 comments on commit 23b9083

Please sign in to comment.