badeball/cypress-cucumber-preprocessor

Upgrade guide from `TheBrainFamily/cypress-cucumber-preprocessor`

badeball opened this issue Β· 127 comments

Transfer of ownership

Due to personal reasons, the previous maintainers of this package are stepping down and handing the reigns over to me, a long-time contributor to the project and a user of it myself. This is a responsibility I'm very excited about. Furthermore, I'd like to thank @lgandecki ++ for all the work that they've done so far.

What's new πŸŽ‰

This implementation has been re-written from scratch in TypeScript, has more thorough test coverage and is filled with a bunch of new feature.

  • Support for the Rule keyword.

  • The cypress-tags has been removed and made redundant. Specs containing no matching scenarios are automatically filtered, provided that filterSpecs is set to true.

  • Screenshots are automatically added to JSON reports (including that of failed tests).

  • Other attachments can be added to the report.

  • JSON reports are generated as a single file and manual, post-merging is no longer required.

  • The package is now located under the name @badeball/cypress-cucumber-preprocessor and a deprecation notice will be posted in the old name once NPM transfer is complete.

  • Methods such as Given, When and Then are imported from @badeball/cypress-cucumber-preprocessor, IE. without the ../steps postfix.

  • A large number of issues has implicitly been fixed due to architectural changes.

  • And(..) and But(..) have been deprecated, read more here.

What's missing

  • Bundled features files. This has been deprioritized, due to the associated maintenance cost, awkward implementation and my personal lack of convincing that it's necessary. Using esbuild gives near-instant compilation time of features and removes nearly all performance gain from bundled features anyway.

Changes to configuration

Nearly all configuration options has been removed and there's no distinction between "global" and "non-global" steps anymore. Steps are searched for using patterns and you can chose to include global steps or not.

Below are some configuration examples. Configuration is still implemented using cosmiconfig, meaning that your configuration can reside in multiple locations, such as package.json or .cypress-cucumber-preprocessorrc.json.

Global step definitions exaple

{
  "name": "my project",
  "depdendencies": {},
  "devDepdendencies": {},
  "cypress-cucumber-preprocessor": {
    "stepDefinitions": "cypress/support/step_definitions/**/*.{js,ts}"
  }
}

Step definitions besides scenario

{
  "name": "my project",
  "depdendencies": {},
  "devDepdendencies": {},
  "cypress-cucumber-preprocessor": {
    "stepDefinitions": "cypress/e2e/[filepath].{js,ts}"
  }
}

Step definitions in a directory besides the scenario

{
  "name": "my project",
  "depdendencies": {},
  "devDepdendencies": {},
  "cypress-cucumber-preprocessor": {
    "stepDefinitions": "cypress/e2e/[filepath]/**/*.{js,ts}"
  }
}

Combination of all of the above (default)

{
  "name": "my project",
  "depdendencies": {},
  "devDepdendencies": {},
  "cypress-cucumber-preprocessor": {
    "stepDefinitions": [
      "cypress/e2e/[filepath]/**/*.{js,ts}",
      "cypress/e2e/[filepath].{js,ts}",
      "cypress/support/step_definitions/**/*.{js,ts}"
    ]
  }
}

Still have an issue?

Because this is a re-implementation and thorough test coverage was originally lacking, old issues may resurface and new issue arise. If you have an issue or just a question, please post it below and I'll try to help.

First off, thank you for your hard work maintaining this project and coordinating the transfer πŸ‘πŸ» I'm very excited to look over the changes and give them a test.

Are you planning to make GitHub releases for the versions you've created and published before the project was fully transferred? That seems like a logical place to start learning about changes.

Are you planning to make GitHub releases for the versions you've created and published before the project was fully transferred? That seems like a logical place to start learning about changes.

This is difficult because some of the version tags would conflict with one another. You can however see the history of the fork here (said link can also be found in the current changelog).

Hey @badeball I would like to second a thank you on your continued maintenance of this project, coordination of the transfer and the updates / refactoring you've done. I'm also excited to take a look and try them out and provide any useful feedback. Well done mate

@badeball - This is great work thanks for keeping it going. I have a question about the config upgrade. Previously steps in folders matching the feature file name would only work in the relevant feature. Is this covered by the config option above:

{
  "name": "my project",
  "depdendencies": {},
  "devDepdendencies": {},
  "cypress-cucumber-preprocessor": {
    "stepDefinitions": "cypress/integration/[filepath]/**/*.{js,ts}"
  }
}

I'm not sure I understand the difference between this one and 'Step definitions besides scenario'. Do we need to explicitly add the filepath for the scenario name or does this value get interpreted at runtime?

Hi, @andyg101

Notice the difference between the following two patterns

cypress/integration/[filepath]/**/*.{js,ts}

.. and

cypress/integration/[filepath].{js,ts}

These will match different files, pick whatever suits you the best.

I've manged to upgrade from 4.3.1 to 9.0.0 but having an issue with the ESBuild plugin. I get this error when i try to use it:

Transforming const to the configured target environment ("es5") is not supported yet

I'm not super familiar with esbuild. Have I missed some obvious configuration here? The only changes I made was to add this to my index.js

on(
     'file:preprocessor',
     createBundler({
       plugins: [createEsbuildPlugin(config)],
     }),
   );

nb. I have got this working with browserify but I believe there is a performance benefit to using ESbuild

Hi, @andyg101

Notice the difference between the following two patterns

cypress/integration/[filepath]/**/*.{js,ts}

.. and

cypress/integration/[filepath].{js,ts}

These will match different files, pick whatever suits you the best.

Thanks @badeball. What I mean is if I have a feature like this

my-feature-with-unique-steps.feature

and a folder

cypress/integration/my-feature-with-unique-steps

Is that covered by the option(s) containing [filepath]?

update: I think i might have managed what I'm trying to do like this:
"cypress/integration/**/[filepath]/**/*.{js,ts}"

The pattern

cypress/integration/[filepath].{js,ts}

.. will for

cypress/integration/my-feature-with-unique-steps.feature

.. be expanded to

cypress/integration/my-feature-with-unique-steps.{js,ts}

.. which will match both cypress/integration/my-feature-with-unique-steps.js and cypress/integration/my-feature-with-unique-steps.ts.

I recommend reading more about patterns here: https://github.com/isaacs/node-glob

I'm not super familiar with esbuild. Have I missed some obvious configuration here? The only changes I made was to add this to my index.js

Do you by any chance have a tsconfig.json lying there as well? If so, what does it contain?

I'm not super familiar with esbuild. Have I missed some obvious configuration here? The only changes I made was to add this to my index.js

Do you by any chance have a tsconfig.json lying there as well? If so, what does it contain?

Yep here it is:

  "compilerOptions": {
    "target": "es5",
    "lib": ["es5", "dom"],
    "typeRoots": ["types", "../node_modules/@types"],
    "types": [
      "cypress",
      "node",
      "cypress-keycloak-commands"
    ],
  },
  "include": [
    "./**/*.ts",
    "./**/*.js"
  ]
}

Esbuild will look for that and configure its target with es5, in which const is apparently not supported. So you have to bump that to something that supports const. I'm guessing you can safely put es6 there as a minimum.

Thanks. I'll give that a go. Help much appreciated @badeball

Hmm. Now I get

node_modules/jju/lib/utils.js:1:18: ERROR: Could not resolve "fs"

That is likely because one of your step definitions is requiring / importing something, that eventually tries to require the fs module, which is unavailable in the browser. Browserify handles it somewhat differently than esbuild, a bit lenient. It would help to know what exactly it is you¨re doing. Can you provide me a repository which I can clone myself? Then I can easily point out the error.

I see jju there. That's a node module and won't work in the browser, browserify or not. Maybe browserify was able to shim out fs and you coincidentally avoided using anything in jju that used fs, but that was just lucky I guess.

I have successfully migrated to badeball/cypress-cucumber-preprocessor and am already observing much faster load times for feature files using webpack, kudos!

I am interested in even better performance from the esbuild example, but am getting similar issues with resolving node modules. The use case is that we have imported a package in a cypress plugin that uses node modules, which runs in cy.task outside of the browser. For any built-in node modules that this package requires, I get an error like this:

[ERROR] Could not resolve "stream" The package "stream" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

Note that in the original webpack configuration the workaround is to use node-polyfill-webpack-plugin.

Do you have recommendations for how to work around this using esbuild?

Do you have recommendations for how to work around this using esbuild?

Can you try @esbuild-plugins/node-modules-polyfill as described here?

I tried that plugin and then got an error about buffer not being defined, so I added the node-globals-polyfill and set buffer to true, then I got require not defined so I set it to true, then got stuck when I got __dirname is not defined. I also tried setting platform: node in the configuration for createBundler but got similar errors.

So no answer yet but we can continue using webpack for now. I can try to use esbuild on a separate/new project to get a working proof of concept and revisit. Thanks for your help!

I see jju there. That's a node module and won't work in the browser, browserify or not. Maybe browserify was able to shim out fs and you coincidentally avoided using anything in jju that used fs, but that was just lucky I guess.

jju is a package we use for parsing json5 (which we are using in our feature files in docstrings). Unfortunately I can't give you a copy of the repo I'm working on. I'm going to try the suggestion in https://esbuild.github.io/getting-started/#bundling-for-node to see if I can get that working.

Update:
I tried using the following

on(
   'file:preprocessor',
   createBundler({
     plugins: [createEsbuildPlugin(config)],
     external: [config.projectRoot + 'node_modules/*'],
     platform: 'node',
   }),
 );

This results in a TypeError

TypeError
The following error originated from your test code, not from Cypress.

  > fn is not a function

When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.

Cypress could not associate this error to any specific test.

We dynamically generated a new test to display this failure.

Which I think is down to the following code (line 5705 is failing)

image

Have to admit I'm a bit out of my depth here in terms of next steps. I think that chai is bundled with Cypress itself so not sure how to fix that.

I was able to get it to compile with jju using a configuration shown below

import * as createBundler from "@bahmutov/cypress-esbuild-preprocessor";
import { createEsbuildPlugin } from "@badeball/cypress-cucumber-preprocessor/esbuild";
import NodeModulesPolyfills from "@esbuild-plugins/node-modules-polyfill";

export default (
  on: Cypress.PluginEvents,
  config: Cypress.PluginConfigOptions
): void => {
  on(
    "file:preprocessor",
    createBundler({
      plugins: [NodeModulesPolyfills(), createEsbuildPlugin(config)],
    })
  );
};

That worked @badeball. Thanks so much for the help!

Also I got the glob matching working as per your suggestion too.

@lgandecki, do you mind transferring the NPM ownership as well? It's currently a bit difficult to realize that there's a new version published (EG. #657 (comment)).

@badeball this is awesome! I was able to get esbuild working with the following configuration similar to what you posted above:

on('file:preprocessor', createBundler({
  plugins: [
    NodeModulesPolyfills(),
    GlobalsPolyfills({
      process: true,
      buffer: true,
    }),
    createEsbuildPlugin(config)
  ],
}));

Incredible performance gains switching to esbuild!

@jwmickey @badeball Thanks for that!!. The configuration you provided worked for the esbuild.

@badeball I do have one issue with the stepDefinitions path. Before I had the following config

  "cypress-cucumber-preprocessor": {
    "nonGlobalStepDefinitions": true,
  },

This allowed me to use a common step folder in cypress/integration/common/[file].ts

While a feature would be in cypress/integration/[feature]/[filepath].feature and the related step definitions in cypress/integration/[feature]/[filepath]/**/*.ts

With the latest version I removed the nonGlobalStepDefinitions as it appears this is no longer necessary however when running cypress it is unable to pickup the step implementation in the cypress/integration/common/[file].ts

I should also mention the related file in here is my Background so my feature file looks like

Feature: Feature #1

	Background:
		Given X
		And Y

	Scenario: Scenario #1
		Given 1
		When 2
		Then 3

The Given step in my Background is not being found which is in a common folder cypress/integration/common/[file].ts. Is there something I'm missing? I've also tried a combination of various stepDefinitions in my config to get this working but still no luck.

@hect1c I have the same set up as you I think and I found this works for common steps in cypress/integration/common

 "cypress-cucumber-preprocessor": {
    "stepDefinitions": "cypress/integration/common/**/*.{js,ts}"
  }

@andyg101 Thanks I had tried that before and it didn't work but I just found out why.

@badeball It appears the cosmiconfig may not be working properly as my configurations were not working when using any variation outside of the package.json . When I moved them back to package.json I got it all working with the following

  "cypress-cucumber-preprocessor": {
    "stepDefinitions": [
      "cypress/integration/common/**/*.{js,ts}",
      "cypress/integration/[filepath]/**/*.{js,ts}",
      "cypress/integration/[filepath].{js,ts}"
    ]
  }

This is how the configuration should look like if placed somewhere aside from package.json:

{
  "stepDefinitions": [
    "cypress/integration/common/**/*.{js,ts}",
    "cypress/integration/[filepath]/**/*.{js,ts}",
    "cypress/integration/[filepath].{js,ts}"
  ]
}

.. notice it is not wrapped in { "cypress-cucumber-preprocessor": { } }.

@badeball Hi Jonas,

I was looking at setting up the json output yesterday. Are the additional parameters you mention meant to go in the json config as well e.g.

  "json": {
    "enabled": true,
    "formatter": "/path/to/formatter"
    "output":"/path/to/output.json"
  }
}

Also, what if I want to have this work on both windows and linux, is there any way to specify an alternative path to the formatter?

Are the additional parameters you mention meant to go in the json config as well e.g.

I don't know which additional parameters you're referring to here, but I'm guessing yes.

Also, what if I want to have this work on both windows and linux, is there any way to specify an alternative path to the formatter?

No, that's not possible. The ability to specify custom location isn't really meant to be done by default. Every developer might have different desire as to where to put these kind of things. Hence, the preprocessor will search for the executable in your PATH if no location is specified. That's what both your Linux and Windows users should do, put the executable somewhere that makes it available from PATH.

Xvier commented

@badeball
I have a question about the filterspec so that it wont report test from other feature files. The example below is created in Typescript but for our project we arent using typescript so do you have an example how to resolve the async await in old JS notation. Since we are using the normal module.exports function style.

import { addCucumberPreprocessorPlugin } from "@badeball/cypress-cucumber-preprocessor";

export default async (
  on: Cypress.PluginEvents,
  config: Cypress.PluginConfigOptions
): Promise<Cypress.PluginConfigOptions> => {
  await addCucumberPreprocessorPlugin(on, config);

  // Make sure to return the config object as it might have been modified by the plugin.
  return config;
}

@Xvier CJS:

const {
  addCucumberPreprocessorPlugin
} = require("@badeball/cypress-cucumber-preprocessor");

module.exports = async (on, config) => {
  await addCucumberPreprocessorPlugin(on, config);

  // Make sure to return the config object as it might have been modified by the plugin.
  return config;
};
Xvier commented

@badeball Thank you very much I overlooked that i had to return the config and thats why I still had faulty results.

@badeball do you have a full example with json reporting? I've enabled them as per json-report and I currently have this plugin working using the webpack example that you've provided (or else the .feature files are not recognised by Cypress).

However, when adding addCucumberPreprocessorPlugin as per the json-report example Cypress throws lots of errors around tasks cannot return undefined which looks to originate from here

@psyvision Are you by any chance using the Run X integration specs button?

@psyvision I've released v9.0.3 which fixes the errors. However, if you're expecting JSON reports during interactive runs you have to have enabled experimentalInteractiveRunEvents. But even then I'm not entirely sure how it'll behave (interactive mode is always a cause of errors as testing it can't be automated...).

@psyvision Are you by any chance using the Run X integration specs button?

I had to look that button up there for a minute, so no :) but I was using interactive and selecting a feature file instead, which is likely a very similar thing under the hood.

@psyvision I've released v9.0.3 which fixes the errors. However, if you're expecting JSON reports during interactive runs you have to have enabled experimentalInteractiveRunEvents. But even then I'm not entirely sure how it'll behave (interactive mode is always a cause of errors as testing it can't be automated...).

I will grab this and give it a try now, I'm not reliant on JSON reports in interactive runs but couldn't get any output so hadn't tried under headless.

Thank you!

@badeball That's giving less errors. The tests run, after closing the browser I then see this error in the Cypress windows:

**Message:** An error was thrown in your plugins file while executing the handler for the `after:spec` event.

The error we received was:

**Details:** TypeError: Cannot read properties of undefined (reading 'tests')
    at Object.handler (node_modules\@badeball\cypress-cucumber-preprocessor\lib\add-cucumber-preprocessor-plugin.js:97:45)
    at invoke (Cypress\Cache\9.5.4\Cypress\resources\app\packages\server\lib\plugins\child\run_plugins.js:22:16)
    at Cypress\Cache\9.5.4\Cypress\resources\app\packages\server\lib\plugins\util.js:45:14
    ...
    at emit (node:internal/child_process:917:12)
    at processTicksAndRejections (node:internal/process/task_queues:84:21)

@psyvision What version of Cypress are you using?

I'm not reliant on JSON reports in interactive runs

I only got the above-mentioned error when I did configure experimentalInteractiveRunEvents, but since you're not interested in JSON reports in interactive mode, you can turn this off. The tests should then run correctly 🀞

I'm not reliant on JSON reports in interactive runs

I only got the above-mentioned error when I did configure experimentalInteractiveRunEvents, but since you're not interested in JSON reports in interactive mode, you can turn this off. The tests should then run correctly 🀞

Thanks @badeball - I'm using Cypress 9.5.4 and have now implemented everything in our containerised CI setup and can produce the cucumber.json files as I had been doing previously. Thank you for your efforts with maintaining and improving this package!

Thanks a lot for all the work on this topic. As @psyvision, if a full example with the json export is available, it would be awesome. I'm pretty lost 😒 so far.

There's not much to it aside from that described in https://github.com/badeball/cypress-cucumber-preprocessor/blob/master/docs/json-report.md. What have you got so far?

Hi Guys I have some questions How I can see Start time and End time in my multiple-cucumber-html-reporter, normally I'm using Cypress, for my report multiple-cucumber-html-reporter, my end time working but the end time is not, maybe you have some suggestions.
image

label: "Execution Start Time",
value: new Date().toLocaleTimeString(),
},
{ label: "Execution End Time", value: new Date().toLocaleString() },
],

Hi @badeball

I'm also still trying to get the json out put working. I have the linux executable on my path and I can see that a file cucumber-messages.ndjson is being created which I think contains the cucumber message format.

However the actual json file I get is empty and I have seen this error in the output

An error was thrown in your plugins file while executing the handler for the 'after:run' event.

The error we received was:

Error: spawn cucumber-json-formatter ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
    at onErrorNT (internal/child_process.js:465:16)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)

My package.json config looks like this

  "cypress-cucumber-preprocessor": {
    "stepDefinitions": [
      "cypress/integration/[filepath]/**/*.{js,ts}",
      "cypress/integration/common/**/*.{js,ts}"
    ],
    "json" : {
      "enabled": true,
      "output": "output/cucumber/json/cucumber-report.json"
    }
  },

Does the target output directory exist? If not, can you create it and try again?

Found the issue. Needed to set the PATH environment variable in the cypress docker image i'm using like this:
ENV PATH="${PATH}:$(pwd)/bin/linux"

Hi Guys I have some questions How I can see Start time and End time in my multiple-cucumber-html-reporter, normally I'm using Cypress, for my report multiple-cucumber-html-reporter, my end time working but the end time is not, maybe you have some suggestions. image

label: "Execution Start Time", value: new Date().toLocaleTimeString(), }, { label: "Execution End Time", value: new Date().toLocaleString() }, ],

Hi AnitaBT
You can use this code to save the test summary after cypress run complete
`
// plugin/index.js

module.exports = (on, config) => {
/*******************************************

  • Cypress Hooks
    *******************************************/
    on('after:run', (results) => {
    if (results) {
    const resultString = \nPassed: ${results.totalPassed} / ${results.totalTests} (total)\nFailed: ${results.totalFailed}\nSkipped: ${results.totalSkipped};
    const summaryDetails = {
    startedTestsAt: results.startedTestsAt,
    endedTestsAt: results.endedTestsAt,
    totalDuration: results.totalDuration,
    totalSuites: results.totalSuites,
    totalTests: results.totalTests,
    totalFailed: results.totalFailed,
    totalPassed: results.totalPassed,
    totalPending: results.totalPending,
    totalSkipped: results.totalSkipped,
    browserName: results.browserName,
    browserVersion: results.browserVersion,
    osName: results.osName,
    environment: config.env.environment,
    status: results.status,
    slackMessage: resultString
    }
    console.log('======================')
    // this file should be saved to yojee-explore/cyreport/summary-report.json
    const summaryReportFilePath = path.join(__dirname, '../../../../cyreport/summary-report.json')
    const slackMessageFilePath = path.join(__dirname, '../../../../cyreport/cypress-e2e-slack-message.txt')
    console.log(summaryReportFilePath)
    console.log(summaryDetails)
    fs.writeFileSync(summaryReportFilePath, JSON.stringify(summaryDetails));
    fs.writeFileSync(slackMessageFilePath, resultString);
    console.log('======================')
    }
    })
    }`

after saving the summary to the file, you can read that file when generating HTML report with the
startedTestsAt: results.startedTestsAt, endedTestsAt: results.endedTestsAt, totalDuration: results.totalDuration,

What should plugin/index.js look like now? No matter what I try doesn't seem to work. It used to be the following which obviously doesn't work now.

const cucumber = require('cypress-cucumber-preprocessor').default

module.exports = (on, config) => {
on('file:preprocessor', cucumber())
}

@robsutherland There are examples for browserify, webpack and esbuild here.

Thanks apparently I was blind.

Greetings,

I tried to update the preprocessor, but i have some problems with the index.js in plugins like @robsutherland and i dont know, how to rewrite the index.js so it matches the index.ts for edbuild in your example folder @badeball.

I also tried to use the index.ts from you examples and i get the following error code from cypress in headmode =

Error: Build failed with 1 error:
node_modules/@badeball/cypress-cucumber-preprocessor/lib/step-definitions.js:54:9: ERROR: [plugin: feature] (intermediate value)(intermediate value)(intermediate value).flatMap is not a function
at failureErrorWithLog (--/node_modules/esbuild/lib/main.js:1603:15)
at runOnEndCallbacks (--/node_modules/esbuild/lib/main.js:1249:28)
at runOnEndCallbacks (--/lem/node_modules/esbuild/lib/main.js:1034:63)
at buildResponseToResult (--/node_modules/esbuild/lib/main.js:1247:7)
at sendRequest (--/lem/node_modules/esbuild/lib/main.js:1356:14)
at responseCallbacks.set (--/lem/node_modules/esbuild/lib/main.js:666:9)
at handleIncomingPacket (--/lem/node_modules/esbuild/lib/main.js:763:9)
at Socket.readFromStdout (--/lem/node_modules/esbuild/lib/main.js:632:7)
at Socket.emit (events.js:198:13)
at addChunk (_stream_readable.js:288:12)
at readableAddChunk (_stream_readable.js:269:11)
at Socket.Readable.push (_stream_readable.js:224:10)
at Pipe.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)

package.json =

"cypress-cucumber-preprocessor": {
"stepDefinitions": "cypress/integration/common/**/*.{js,ts}"
},

Thanks in advance.

Edit :

also when i dont define "esbuild": "latest" in package.json i got the following error code =

Error: Cannot find module 'esbuild'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object. (--/node_modules/@bahmutov/cypress-esbuild-preprocessor/src/index.js:1:17)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object. (--/cypress/plugins/index.ts:1:1)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Module.m._compile (--/.cache/Cypress/9.6.0/Cypress/resources/app/node_modules/ts-node/src/index.ts:536:23)
at Module._extensions..js (internal/modules/cjs/loader.js:789:10)

@badeball so i got the cucumber reports working as we discussed but i noticed that the step timings are now missing. I don't see them in the json being output so i don't believe it is a problem with the reports. Am i missing something here with the confg?

@SirCmX it’s impossible for me to say what’s wrong given the provided information. Are you using a node version less than 11.0.0?

i get an error when use the command npm install =
npm WARN notsup Unsupported engine for cypress@9.6.0: wanted: {"node":">=12.0.0"} (current: {"node":"10.19.0","npm":"6.14.4"})

but my dependencies are like this :

"dependencies": {
"@badeball/cypress-cucumber-preprocessor": "latest",
"@bahmutov/cypress-esbuild-preprocessor": "latest",
"cypress": "latest",
"node": "12.14.0",
"typescript": "latest",
"esbuild": "0.14.38",
"cypress-get-table": "1.0.1",
"cypress-file-upload": "5.0.8"
}

edit : i also tried to use "node": "latest" , but i got the same error.

@SirCmX you have to use a more recent version of nodejs, not the package named node.

Yeah, thats true. I am a newbie in ubunto and just updated the version of node.js. Thanks, that helped me a lot.

Could you maybe help me with the index.js in plugins? =

const cucumber = require('cypress-cucumber-preprocessor').default

module.exports = (on, config) => {
on('file:preprocessor', cucumber())
}

how do i need to change the code , so it can work like the index.js in your examples for esbuild?

Why don't you just use the example as a starting point? I don't know what else to do other than refer to these.

@badeball so i got the cucumber reports working as we discussed but i noticed that the step timings are now missing. I don't see them in the json being output so i don't believe it is a problem with the reports. Am i missing something here with the confg?

Those were indeed missing and that was just an oversight from my part. I've released v9.1.1. where messages contain timestamps and durations.

Yeah, thats true. I am a newbie in ubunto and just updated the version of node.js. Thanks, that helped me a lot.

Could you maybe help me with the index.js in plugins? =

const cucumber = require('cypress-cucumber-preprocessor').default

module.exports = (on, config) => { on('file:preprocessor', cucumber()) }

how do i need to change the code , so it can work like the index.js in your examples for esbuild?

@SirCmX try like this

const createEsbuildPlugin =
  require('@badeball/cypress-cucumber-preprocessor/esbuild').createEsbuildPlugin;
const createBundler = require('@bahmutov/cypress-esbuild-preprocessor');
const nodePolyfills =
  require('@esbuild-plugins/node-modules-polyfill').NodeModulesPolyfillPlugin;
const addCucumberPreprocessorPlugin =
  require('@badeball/cypress-cucumber-preprocessor').addCucumberPreprocessorPlugin;

module.exports = async (on, config) => {
  await addCucumberPreprocessorPlugin(on, config); // to allow json to be produced

// To use esBuild for the bundler when preprocessing
  on(
    'file:preprocessor',
    createBundler({
      plugins: [nodePolyfills(), createEsbuildPlugin(config)],
    }),
  );

return config;
}

I'm not an expert in the different kinds of module imports in JS (and definitely not typescript) but this worked for me.

Why don't you just use the example as a starting point? I don't know what else to do other than refer to these.

It worked out, but my coworker and me dont have the experience with typescript and in near future we want to expand it.

Yeah, thats true. I am a newbie in ubunto and just updated the version of node.js. Thanks, that helped me a lot.
Could you maybe help me with the index.js in plugins? =
const cucumber = require('cypress-cucumber-preprocessor').default
module.exports = (on, config) => { on('file:preprocessor', cucumber()) }
how do i need to change the code , so it can work like the index.js in your examples for esbuild?

@SirCmX try like this

const createEsbuildPlugin =
  require('@badeball/cypress-cucumber-preprocessor/esbuild').createEsbuildPlugin;
const createBundler = require('@bahmutov/cypress-esbuild-preprocessor');
const nodePolyfills =
  require('@esbuild-plugins/node-modules-polyfill').NodeModulesPolyfillPlugin;
const addCucumberPreprocessorPlugin =
  require('@badeball/cypress-cucumber-preprocessor').addCucumberPreprocessorPlugin;

module.exports = async (on, config) => {
  await addCucumberPreprocessorPlugin(on, config); // to allow json to be produced

// To use esBuild for the bundler when preprocessing
  on(
    'file:preprocessor',
    createBundler({
      plugins: [nodePolyfills(), createEsbuildPlugin(config)],
    }),
  );

return config;
}

I'm not an expert in the different kinds of module imports in JS (and definitely not typescript) but this worked for me.

Thanks @andyg101 , this is exactly what we needed and everything is working! :)

It worked out, but my coworker and me dont have the experience with typescript and in near future we want to expand it.

I see. Ideally I would have liked to write all my examples in both CJS, ESM and TS, in kind of a tab view, but markdown doesn't provide that kind of sophistication. A more long term strategy might be to use Github pages for documentation, but that's future work.

Anyway, I'm glad you worked it out.

I'm trying to uninstall the previous preprocessor and install the @badeball version, but I'm getting this error when running my tests:

Expected to find a global registry (this usually means you are trying to define steps or hooks in support/index.js, which is not supported) (this might be a bug, please report at https://github.com/badeball/cypress-cucumber-preprocessor)

Not sure what's going on as I've commented out all my code in support/index.js.

Any ideas?

It’s not clear what’s going on given the provided information. Can you provide me a minimal example which I can run myself and see the error?

I think I have fixed this, ignore my previous comment. Thanks anyway

Has anyone been able to get the plugin to work with Node v12.11.1, npm v6.13.6. I'm trying to get multiple-cucumber-html-reporter to work again after the update. Would really appreciate any help.

This is the content of my plugin/index.ts file:

const createEsbuildPlugin = require('@badeball/cypress-cucumber-preprocessor/esbuild').createEsbuildPlugin;
const createBundler = require('@bahmutov/cypress-esbuild-preprocessor');
import NodeModulesPolyfills from "@esbuild-plugins/node-modules-polyfill";
const addCucumberPreprocessorPlugin = require('@badeball/cypress-cucumber-preprocessor').addCucumberPreprocessorPlugin;

module.exports = async (on, config) => {
  await addCucumberPreprocessorPlugin(on, config); // to allow json to be produced

// To use esBuild for the bundler when preprocessing
  on(
    'file:preprocessor',
    createBundler({
      plugins: [NodeModulesPolyfills(), createEsbuildPlugin(config)],
    }),
  );

  // on('after:run', (results) => {
  //   if (results) {
  //     fs.writeFile('cypress/report/results.json', JSON.stringify(results));
  //   }
  // });

  return config;
}

I'm running into this error when I try to run it: npx cypress run

An error was thrown in your plugins file while executing the handler for the before:run event.

The error we received was:

TypeError: fs_1.promises.rm is not a function
    at Object.handler (C:\Work\curator-app\node_modules\@badeball\cypress-cucumber-preprocessor\lib\add-cucumber-preprocessor-plugin.js:49:29)
    at invoke (C:\Users\User1\AppData\Local\Cypress\Cache\9.6.0\Cypress\resources\app\packages\server\lib\plugins\child\run_plugins.js:22:16)
    at C:\Users\User1\AppData\Local\Cypress\Cache\9.6.0\Cypress\resources\app\packages\server\lib\plugins\util.js:45:14
    at tryCatcher (C:\Users\User1\AppData\Local\Cypress\Cache\9.6.0\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\util.js:16:23)
    at Function.Promise.attempt.Promise.try (C:\Users\User1\AppData\Local\Cypress\Cache\9.6.0\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\method.js:39:29)
    at Object.wrapChildPromise (C:\Users\User1\AppData\Local\Cypress\Cache\9.6.0\Cypress\resources\app\packages\server\lib\plugins\util.js:44:23)
    at wrapChildPromise (C:\Users\User1\AppData\Local\Cypress\Cache\9.6.0\Cypress\resources\app\packages\server\lib\plugins\child\run_plugins.js:116:10)
    at execute (C:\Users\User1\AppData\Local\Cypress\Cache\9.6.0\Cypress\resources\app\packages\server\lib\plugins\child\run_plugins.js:129:14)
    at EventEmitter.<anonymous> (C:\Users\User1\AppData\Local\Cypress\Cache\9.6.0\Cypress\resources\app\packages\server\lib\plugins\child\run_plugins.js:213:5)
    at EventEmitter.emit (events.js:210:5)
    at process.<anonymous> (C:\Users\User1\AppData\Local\Cypress\Cache\9.6.0\Cypress\resources\app\packages\server\lib\plugins\util.js:19:22)
    at process.emit (events.js:210:5)
    at process.emit (C:\Users\User1\AppData\Local\Cypress\Cache\9.6.0\Cypress\resources\app\node_modules\source-map-support\source-map-support.js:495:21)
    at emit (internal/child_process.js:876:12)
    at processTicksAndRejections (internal/process/task_queues.js:81:21)

config in package.json:

"cypress-cucumber-preprocessor": {
    "json": {
      "enabled": true
    }
  },

@nasserabdullah That method was introduced in node v14.14.0, so you have to upgrade.

@badeball - regarding the esbuild bundler I think it is worth adding the sourcemap parameter so that you can have separate source files for debugging e.g.

 on(
    'file:preprocessor',
    createBundler({
      plugins: [nodePolyfills(), createEsbuildPlugin(config)],
      sourcemap: 'both', // This is required for separate source files when debugging.
    }),
  );

Hey,
I'm trying to put a cy.intercept(...).as("query") in my Before() hook, in order to use cy.wait("@query").its(...).should(...) in a later step.
No matter what I do I get a Cannot read properties of null (reading 'seconds') error from @badeball/cypress-cucumber-preprocessor/lib/create-tests.js:55:38 (at seconds: end.seconds - start.seconds)
Is this a bug or am I doing something wrong ?

@psyvision thank you, it's fixed for now ! :)

@MartialJarry from #701 (comment)

I've released v9.1.2 which I believe fixes the problem.

@MartialJarry from #701 (comment)

I've released v9.1.2 which I believe fixes the problem.

Somewhat related to what I asked in #689 (comment), are you planning to publish GitHub releases at all for the new versions since v9? I have a hard time following the amazing work and progress you've made because I don't get notifications for the GitHub releases (and don't want to subscribe to all updates for the repo).

Hello, I'm having some issues since I upgraded from TheBrainFamily/cypress-cucumber-preprocessor. All my existing tests are now failing, complaining about either this:

The following error originated from your test code, not from Cypress. It was caused by an unhandled promise rejection.

  > Cypress detected that you returned a promise from a command while also invoking one or more cy commands in that promise.

The command that returned the promise was:

  > cy.visit()

The cy command you invoked inside the promise was:

  > cy.log()

Because Cypress commands are already promise-like, you don't need to wrap them or return your own promise.

Cypress will resolve your command with whatever the final Cypress command yields.

The reason this is an error instead of a warning is because Cypress internally queues commands serially whereas Promises execute as soon as they are invoked. Attempting to reconcile this would prevent Cypress from ever resolving.

When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.

Or this:
cy.get() could not find a registered alias for @couponId, whereby @couponId is an alias used in a different, unrelated spec.

I have never seen these issues before. I'm using Cypress 8.7.0 if that helps.

Thanks in advance

@LoukasKonstantinou you have to provide me an example that lets me reproduce the problem.

Not sure how I can do that without sharing my whole framework though?

I'm not interested in everything you've got, instead I want you condense it into something as small as possible that still produce the error. Otherwise I can't do anything to help you. Right now you've omitted to provide me anything useful.

Hello, I'm having some issues since I upgraded from TheBrainFamily/cypress-cucumber-preprocessor. All my existing tests are now failing, complaining about either this:

The following error originated from your test code, not from Cypress. It was caused by an unhandled promise rejection.

  > Cypress detected that you returned a promise from a command while also invoking one or more cy commands in that promise.

The command that returned the promise was:

  > cy.visit()

The cy command you invoked inside the promise was:

  > cy.log()

Because Cypress commands are already promise-like, you don't need to wrap them or return your own promise.

Cypress will resolve your command with whatever the final Cypress command yields.

The reason this is an error instead of a warning is because Cypress internally queues commands serially whereas Promises execute as soon as they are invoked. Attempting to reconcile this would prevent Cypress from ever resolving.

When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.

Or this: cy.get() could not find a registered alias for @couponId, whereby @couponId is an alias used in a different, unrelated spec.

I have never seen these issues before. I'm using Cypress 8.7.0 if that helps.

Thanks in advance

@LoukasKonstantinou - I had this exact error. I think it is because you are doing a return from the step definintition code. e.g.

Given('Some step') ()=> {
  return cy.blah( ...)   <---- this fails
}


Given('Some step') ()=> {
   cy.blah( ...)   <---- this doesn't fail
}

Thanks so much @andyg101 , that indeed solves one of my two issues.

Anyone else has encountered the issue with Cypress complaining about an unrelated alias?

Edit:

Or this:
cy.get() could not find a registered alias for @couponId, whereby @couponId is an alias used in a different, unrelated spec.

This one appears to be happening in every after hook. I think it is getting confused and calling an After hook from a different steps file, but how is that possible?

I'm guessing you have not configured stepDefinitions to scope as narrowly as you'd hoped, but it's impossible to say given the provided information. In this case you have to provide your configuration, as well as the location of a feature file, location of its step definitions and location of the After hook you mean to not include.

Thanks so much @andyg101 , that indeed solves one of my two issues.

Anyone else has encountered the issue with Cypress complaining about an unrelated alias?

Edit:

Or this:
cy.get() could not find a registered alias for @couponId, whereby @couponId is an alias used in a different, unrelated spec.

This one appears to be happening in every after hook. I think it is getting confused and calling an After hook from a different steps file, but how is that possible?

Good stuff. I'm afraid for this other error I'm not sure. I didn't have anything like that.

So this is my config:

  "cypress-cucumber-preprocessor": {
    "stepDefinitions": "cypress/integration/**/*.{js,ts}",
    "nonGlobalStepDefinitions": true,
    "cucumberJson": {
      "generate": true,
      "outputFolder": "cypress/results/cucumber-json",
      "filePrefix": "",
      "fileSuffix": ".cucumber"
    }
  },

This is the location of the feature file: cypress/integration/createCoupon.feature
This is the location of the step definitions file: cypress/integration/createCoupon/createCoupon.steps.js
The After hook that is incorrectly called is in: cypress/integration/createCard/createCard.steps.js

Thanks in advance for your help

So this is my config:

  "cypress-cucumber-preprocessor": {
    "stepDefinitions": "cypress/integration/**/*.{js,ts}",
    "nonGlobalStepDefinitions": true,
    "cucumberJson": {
      "generate": true,
      "outputFolder": "cypress/results/cucumber-json",
      "filePrefix": "",
      "fileSuffix": ".cucumber"
    }
  },

This is the location of the feature file: cypress/integration/createCoupon.feature This is the location of the step definitions file: cypress/integration/createCoupon/createCoupon.steps.js The After hook that is incorrectly called is in: cypress/integration/createCard/createCard.steps.js

Thanks in advance for your help

Maybe this helps:

"stepDefinitions": [
  "cypress/integration/common/**/*.{js,ts}",
  "cypress/integration/[filepath]/**/*.{js,ts}"
]

We had the same problems and i could fix the whole scope with the code above.

so delete this :

 "stepDefinitions": "cypress/integration/**/*.{js,ts}",
 "nonGlobalStepDefinitions": true,

and copy the code above.

Edit:
I guess it should work with that piece of code:

"stepDefinitions": [
  "cypress/integration/**/*.{js,ts}",
  "cypress/integration/[filepath]/*.{js,ts}"
]

Hi Badeball, I previously used cypress-cucumber-preprocessor using this guideline -> https://www.npmjs.com/package/cypress-cucumber-preprocessor I understand that in place of install npm install --save-dev cypress-cucumber-preprocessor now I should use this guideline -> https://www.npmjs.com/package/@badeball/cypress-cucumber-preprocessor implementing npm install @badeball/cypress-cucumber-preprocessor. Let me know if I am wrong.

Hi, I'm trying to execute a cy.task inside of the afterEach() hook function method at cypress/support/index.ts. What I have is:

afterEach(function () {
  cy.task('wipeData');
});

but I'm having this issue:

cy.task('wipeData') failed with the following error:
> Cypress is not defined

Can someone help me, please? :)

Dependencies

  "dependencies": {
    "@badeball/cypress-cucumber-preprocessor": "~9.1.3",
    "@bahmutov/cypress-extends": "~1.1.0",
    "@cypress/browserify-preprocessor": "~3.0.2",
    "@testing-library/cypress": "^8.0.2",
    "@types/node": "^17.0.31",
    "@typescript-eslint/eslint-plugin": "^5.10.2",
    "@typescript-eslint/parser": "^5.10.2",
    "browserify": "^17.0.0",
    "cucumber-html-reporter": "^5.5.0",
    "cypress": "~9.4.1",
    "eslint": "^8.8.0",
    "eslint-plugin-cypress": "^2.12.1",
    "mysql": "^2.18.1",
    "ts-node": "^10.7.0",
    "typescript": "^4.6.4"
  },

@nunobentouk, you're not providing enough information.

I'm trying to execute a cypress task inside of the afterEach hook function, but for some strange reason when my test finishes and runs the afterEach method I'm having this issue: > Cypress is not defined. Looks like I can't run any cy instruction inside of the after each Mocha hook...and I really don't know why.

Screenshot 2022-05-13 at 12 48 05

@badeball Should I open a separate thread to this one? I'm asking because this is not related to the migration of TheBrainFamily/cypress-cucumber-preprocessor

Thanks

Sure, do that and make sure to provide an example that lets me reproduce the behavior.

How are the below parameters configured after the changes?

"cucumberJson": {
      "generate": true,
      "outputFolder": "cypress/results/cucumber-json",
      "filePrefix": "",
      "fileSuffix": ".cucumber"
    }

The documentation only mentions the parameter:

{ "json": { "enabled": true } }

@OSnuszka, from https://github.com/badeball/cypress-cucumber-preprocessor/blob/master/docs/json-report.md:

The report is outputted to cucumber-report.json in the project directory, but can be configured through the json.output property.

Hats off for the awesome work! @badeball
One feedback, please reconsider the bundled features files. I don't know if it provided any performance benefits but it was a very convenient feature to send test results to TestRail as if it was the result of one test run with with testrail reporters like hanoi-cypress-testrail-reporter, etc.

With the new version of cypress-cucumber-preprocessor, cypress is treating each feature file as a new session and the reporters are creating a new test run in TestRail for each feature file. I ended up with 30 new test runs each containing contents of only 1 feature file of test cases in Testrail with one test execution :/

I'll have to keep the changes I made for the new version until this feature comes back, hopefully before the old version gets completely deprecated and removed πŸ€žπŸ»πŸ€žπŸ»πŸ˜… Otherwise I probably should start thinking about a way to removing everything and going back to default sad spec files of Cypress.

@serhatgemici, this is something that should be fixed in the test reporters you mention and I'm unfortunately not going to introduce a feature just to workaround their shortcomings.

@badeball That's amazing. Yeah I'll surely contact the other side and ask for the possibility for an update for the new preprocessor, but still it's not the best experince when people trusted and built their systems based on a feature set once was perfectly working without causing "shortcomings", and then the next day someone decides to change that, just saying.

Peace ✌🏻

Which HTML Reporter works best with the new version?

Has anybody have this issue with the JSON report ?

Not sure if the JSON report supposed to keep the failed retried runs & screenshots instead of overwriting the final state, so I couldn't decide if that's an issue with the HTML reporter or the preprocessor, but here's my question:

I'm running a feature file that has 2 scenarios, and my "retries" config in cypress.json is set to 2.
When I run the test for this feature file, out of these 2 scenarios, the first scenario fails on the first try, but on the second try it passes.
So the final result I get on the console is All specs passed! as follows:
2022-05-18_16-52-06

However, when I generate the HTML report out of the JSON file, I see that it shows 3 runs, and the final state of the retried Scenario is failed, even though it was passing on the first retry.

I'm using Multiple Cucumber HTML report and the report looks like this for this case:

2022-05-18_18-05-58

2022-05-18_18-06-49

This is the feature file:

Feature: Login
xxx users must be able to login xxx

Background: User is ready to make a xxx
    Given user landed on the SUT on "default"
    And user enter a valid PLZ
    And clicks xxx button
    And user must land on homepage

@focus @functional @smoke @high @positive
Scenario: C2412 Login via header (happy path)
    When user logs in from the xxx page
    Then user must land on homepage

@functional @smoke @high @positive
Scenario: C20 Login via order (happy path)
    When user makes a ...
    And clicks ...
    And enters "registered" email
    And enters password for "registered"
    And clicks ....
    Then user must land on "...." page

my package.json

"devDependencies": {
    "@badeball/cypress-cucumber-preprocessor": "^9.2.1",
    "@bahmutov/cypress-esbuild-preprocessor": "^2.1.3",
    "@esbuild-plugins/node-modules-polyfill": "^0.1.4",
    "cypress": "^9.6.1",
    "cypress-iframe": "^1.0.1",
    "cypress-multi-reporters": "^1.5.0",
    "cypress-plugin-tab": "^1.0.5",
    "cypress-wait-until": "^1.7.2",
    "esbuild": "^0.14.39",
    "eslint": "^8.8.0",
    "eslint-config-airbnb-base": "^15.0.0",
    "eslint-plugin-import": "^2.25.4",
    "hanoi-cypress-testrail-reporter": "^2.2.0",
    "multiple-cucumber-html-reporter": "^1.20.0",
    "typescript": "^4.6.4"
  },
  "cypress-cucumber-preprocessor": {
    "stepDefinitions": [
      "cypress/integration/[filepath]/**/*.{js,ts}",
      "cypress/support/common_step_definitions/*.{js,ts}"
    ],
    "json": {
      "enabled": true,
      "formatter": "cypress/formatter/cucumber-json-formatter",
      "output": "cypress/test-results/cucumber-json/cucumber-report.json"
    }
  }
}

Here is my index.ts

const createEsbuildPlugin = require('@badeball/cypress-cucumber-preprocessor/esbuild').createEsbuildPlugin;
const createBundler = require('@bahmutov/cypress-esbuild-preprocessor');
import NodeModulesPolyfills from "@esbuild-plugins/node-modules-polyfill";
const addCucumberPreprocessorPlugin = require('@badeball/cypress-cucumber-preprocessor').addCucumberPreprocessorPlugin;

export default async (
  on: Cypress.PluginEvents,
  config: Cypress.PluginConfigOptions
): Promise<Cypress.PluginConfigOptions> => {
  await addCucumberPreprocessorPlugin(on, config);

  on(
    'file:preprocessor',
    createBundler({
      plugins: [NodeModulesPolyfills(), createEsbuildPlugin(config)],
    }),
  );

  return config;
}

Here is my report.js

const report = require('multiple-cucumber-html-reporter');

 report.generate({
   jsonDir: './cypress/test-results/cucumber-json',
   reportPath: './cypress/test-results/html',
   metadata:{
         browser: {
             name: 'chrome',
             version: 'Chrome'
         },
         device: 'xxxx',
         platform: {
             name: 'ubuntu',
             version: 'ubuntu'
         }
     },
     customData: {
         title: 'Run info',
         data: [
             {label: 'Project', value: 'xxxx'}
         ]
     }
 });

Thanks everybody in advance!

@serhatgemici this is due to an error in the standalone JSON formatter and I've reported it here.

Hello, migrating from TheBrainFamily/cypress-cucumber-preprocessor, how should we change this line in plugins/index.js?

on('file:preprocessor', cucumber());

Thanks

@erendemirel look at any of the examples.

@badeball Thanks but I was looking for a pure js solution, would it be possible?

@badeball Thanks but I was looking for a pure js solution, would it be possible?

@erendemirel look further up this thread. One of my posts I think has what you need

#689 (comment)

I'm getting the following error on my Azure pipeline, has anyone had something similar? How did you manage it?

Thanks a lot in advance!


tput: No value for $TERM and no -T specified
================================================================================

  (Run Starting)

  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚ Cypress:        9.6.1                                                                          β”‚
  β”‚ Browser:        Chrome 101 (headless)                                                          β”‚
  β”‚ Node Version:   v10.24.1 (/opt/hostedtoolcache/node/10.24.1/x64/bin/node)                      β”‚
  β”‚ Specs:          1 found (xxxxxxxxxxxx/Login.feature)                                           β”‚
  β”‚ Searched:       cypress/integration/xxxxxxxxxxxx/Login.feature                                 β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

An error was thrown in your plugins file while executing the handler for the before:run event.

The error we received was:

TypeError: fs_1.promises.rm is not a function
    at beforeRunHandler (/home/vsts/work/1/s/tests/node_modules/@badeball/cypress-cucumber-preprocessor/lib/add-cucumber-preprocessor-plugin.js:51:25)
    at process._tickCallback (internal/process/next_tick.js:68:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! cypress-demo@1.0.0 test:dev: `cypress run --browser chrome --env url=https://xxxxxx.xxxxxxxxxxx.de/ --spec 'cypress/integration/xxxxxxxxxxxx/Login.feature'`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the cypress-demo@1.0.0 test:dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/vsts/.npm/_logs/2022-05-19T08_28_35_122Z-debug.log
##[error]Bash exited with code '1'.
Finishing: Run Cypress Tests

So there is no way to have non-global steps anymore?
All the steps are global, so there is no way to have the same regex for steps in different features?