Skip to content

Commit

Permalink
remove the cypress v5+ native retries suffix from the file name (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
lmeikle authored Jan 16, 2021
1 parent d031708 commit cf42ab4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,13 @@ export function matchImageSnapshotPlugin({ path: screenshotPath }) {
const receivedImageBuffer = fs.readFileSync(screenshotPath);
fs.removeSync(screenshotPath);

const { dir: screenshotDir, name: snapshotIdentifier } = path.parse(
const { dir: screenshotDir, name } = path.parse(
screenshotPath
);

// remove the cypress v5+ native retries suffix from the file name
const snapshotIdentifier = name.replace(/ \(attempt [0-9]+\)/, '');

const relativePath = path.relative(screenshotsFolder, screenshotDir);
const snapshotsDir = customSnapshotsDir
? path.join(process.cwd(), customSnapshotsDir, relativePath)
Expand Down

0 comments on commit cf42ab4

Please sign in to comment.