simonsmith/cypress-image-snapshot

empty folder is added at the screenshotsFolder path

maximegheraille opened this issue · 3 comments

Hi,

I do have a weird issue when taking screenshots, where I get a random folder with my test file name + extension created which is empty.
As an example, this gets generated from the matchImageSnapshot function.
/reports/mochareports/snapshot/brand/env/TestFileName/actualSnapshotName.png

But I also get this folder which is always empty
/reports/mochareports/snapshot/brand/TestFileName.ts

This is my current config

const options: CypressImageSnapshotOptions = {
			failureThreshold: 0.1,
			allowSizeMismatch: true,
			failureThresholdType: 'percent',
			capture: 'viewport',
			comparisonMethod: 'ssim',
			customSnapshotsDir: `./cypress/reports/mochareports/snapshots/${Cypress.env(
				'brand',
			)}/${Cypress.env('env')}/${
				Cypress.spec.fileName
			}`,
			e2eSpecDir: `${Cypress.spec.relative}`,
		};

My cypress config contains screenshotsFolder: 'cypress/reports/mochareports/snapshots'

Yeah, I've seen that as well. I think it's because the screenshots get put there first before the plugin can move them but I'm not totally sure. Perhaps they can be cleaned up. I tend to gitignore them at the moment

indeed, might be an idea to add an option to delete that folder which is defined in the cypress config when the plugin runs. Otherwise I guess I will go with a .gitignore rule

I'll take a look at this, but for now the .gitignore workaround is probably best