Skip to content

[Bug] Changing reportDir does not produce index.js or dist folder #17

@tremorth

Description

@tremorth

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:

image

  1. Change configuration.reportDir = 'some_dir'

  2. 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:

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions