I am trying to implement cypress-cucumber-preprocessor for Cypress 11 with TypeScript, but I am unsure what I miss. Here are the steps that I do:
npm install @badeball/cypress-cucumber-preprocessor
import { addCucumberPreprocessorPlugin } from "@badeball/cypress-cucumber-preprocessor";
export default defineConfig({
projectId: '7emkc5',
reporter: 'mochawesome',
reporterOptions: {
reportDir: 'cypress/report/mochawesome-report',
overwrite: false,
html: true,
json: true,
timestamp: 'dd-mm-yyyy_HH-MM-ss',
},
chromeWebSecurity: false,
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
return require('./cypress/plugins/index.js')(on, config)
},
specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}',
},
})
I am using the last version of Cypress 11.1.0 and typescript.
Just follow the guide to install TS https://docs.cypress.io/guides/tooling/typescript-support#Install-TypeScript
then, paste this https://github.com/badeball/cypress-cucumber-preprocessor/blob/master/docs/quick-start.md in your cypress.config.ts
install bahmutov lib too:
npm i @bahmutov/cypress-esbuild-preprocessor
this works for me... good luck!
Here is the clean flow to add the plugin to Cypress 10+ with TypeScript:
However, now I have a different problem. It seems that I am not able to add some plugins to the 'setupNodeEvents' method. I ask a new question here .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.