I am using the configuration object, which can be used to change the path where the HTML report is generated.
So I am running it like this:
const jestScreenshot = require('jest-screenshot');
const {getTestScope} = require('../fakedata');
const {config, toMatchImageSnapshot} = jestScreenshot;
jestScreenshot.setupJestScreenshot();
expect.extend({
screenshotMatcher(received, threshold) {
const configuration = config();
configuration.snapshotsDir = '../__snapshots__/';
configuration.reportDir = `screenshot-report-${getTestScope()}`;
if (threshold) {
configuration.pixelThresholdAbsolute = threshold;
configuration.pixelThresholdRelative = null;
} else {
configuration.pixelThresholdRelative = 0;
configuration.pixelThresholdAbsolute = 0;
}
return toMatchImageSnapshot.call(this, received, configuration);
}
});
To reproduce the bug
What the report folder should have:

-
Change configuration.reportDir = 'some_dir'
-
Run tests that has failing image
On image-diff failure, index.js or dist-folder are not created under 'some_dir'. No HTML report is available.
What the report folder has:

I am using the configuration object, which can be used to change the path where the HTML report is generated.
So I am running it like this:
To reproduce the bug
What the report folder should have:
Change
configuration.reportDir = 'some_dir'Run tests that has failing image
On image-diff failure,
index.jsordist-folder are not created under 'some_dir'. No HTML report is available.What the report folder has: