Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property 'matchImageSnapshot' does not exist on type 'cy & EventEmitter' #220

Open
iten74 opened this issue Aug 24, 2021 · 4 comments
Open

Comments

@iten74
Copy link

iten74 commented Aug 24, 2021

Configured the plugin as outlined but cypress does not recognize it. The plugin works if I add @ts-ignore in front of the line cy.matchImageSnapshot();, but I'd rather be able to configure the framework correctly so cypress doesn't complain.
Any idea?

index.js:

const cucumber = require('cypress-cucumber-preprocessor').default;
const browserify = require('@cypress/browserify-preprocessor');
const resolve = require('resolve');
const { addMatchImageSnapshotPlugin } = require('cypress-image-snapshot/plugin');

module.exports = (on, config) => {
    const options = {
        ...browserify.defaultOptions,
        typescript: resolve.sync('typescript', { baseDir: config.projectRoot })
    };
    on('file:preprocessor', cucumber(options));
    addMatchImageSnapshotPlugin(on, config);
};

commands.js

import { addMatchImageSnapshotCommand } from 'cypress-image-snapshot/command';
addMatchImageSnapshotCommand();
@ma-bourassa
Copy link

Try to run npm i @types/cypress-image-snapshot -D

@DCzajkowski
Copy link

Solved it for me. Thanks @ma-bourassa!

@jake-nz
Copy link

jake-nz commented Oct 11, 2021

I also needed
/// <reference types="cypress-image-snapshot" />

@dhakalsamundra
Copy link

@ma-bourassa, even I add the @types/cypress-image-snapshot, there is same error. But if i add this:
/// , it will resolved. I do not want to add this reference in all of my test file. is there is way to fix without writing reference?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants