Giter Club home page Giter Club logo

Comments (6)

cloakedninjas avatar cloakedninjas commented on September 27, 2024 1

Ran into this too - looks like it's not an issue with Cucumber, but with TypeScript preprocessor

Oops...we found an error preparing this test file:

  cypress/integration/home/home.spec.ts

The error was:

Error: Webpack Compilation Error
/app/cypress/integration/home/home.spec.ts
./cypress/integration/home/home.spec.ts 35:23-38
[tsl] ERROR in /app/cypress/integration/home/home.spec.ts(35,24)
      TS2339: Property 'compareSnapshot' does not exist on type 'Chainable<JQuery<HTMLBodyElement>>'.
    at handle (/app/node_modules/@cypress/webpack-preprocessor/dist/index.js:172:23)

Using the following

// plugins/index.js
const cypressTypeScriptPreprocessor = require('./cy-ts-preprocessor');

module.exports = (on, config) => {
    const getCompareSnapshotsPlugin = require('cypress-image-diff-js/dist/plugin');
    getCompareSnapshotsPlugin(on, config);

    on('file:preprocessor', cypressTypeScriptPreprocessor);
    return config;
};

from cypress-image-diff.

PippoRaimondi avatar PippoRaimondi commented on September 27, 2024

yes, add the below to plugin/index.js:

const compareSnapshotCommand = require('cypress-image-diff-js/dist/command')
compareSnapshotCommand()

so it will look like:

const cucumber = require('cypress-cucumber-preprocessor').default
const browserify = require('@cypress/browserify-preprocessor');
const resolve = require('resolve');
const getCompareSnapshotsPlugin = require('cypress-image-diff-js/dist/plugin')
module.exports = (on, config) => {
const options = {
...browserify.defaultOptions,
typescript: resolve.sync('typescript', { baseDir: config.projectRoot }),
};

on('file:preprocessor', cucumber(options));
const compareSnapshotCommand = require('cypress-image-diff-js/dist/command')
compareSnapshotCommand()
};

from cypress-image-diff.

ohmygar1989 avatar ohmygar1989 commented on September 27, 2024

image
Thanks for your information! But I still cannot find the command after using your setting. :(

from cypress-image-diff.

PippoRaimondi avatar PippoRaimondi commented on September 27, 2024

I just realised you have the wrong imports happening... please follow the documentation below carefully:

https://github.com/uktrade/cypress-image-diff/blob/main/docs/Cypress%20integration.md

It's proven to work with cucumber setup so this is a setup issue in your end. I will be closing this issue shortly.

from cypress-image-diff.

PippoRaimondi avatar PippoRaimondi commented on September 27, 2024

This is a setup issue.

from cypress-image-diff.

IndBar avatar IndBar commented on September 27, 2024

solved this by using a different location: instead of cypress-image-diff-js/dist/command, I used cypress-image-diff-js/command .

commnds.js file

const compareSnapshotCommand = require('cypress-image-diff-js/command');
compareSnapshotCommand();

cypress.config.js
const getCompareSnapshotsPlugin = require('cypress-image-diff-js/plugin');

    setupNodeEvents(on, config) {
      require('./cypress/plugins/index.js')(on, config);
      cypressSplit(on, config);
      getCompareSnapshotsPlugin(on, config)
      return config;
    },

from cypress-image-diff.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.