You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently using jest and jest-cucumber with Typescript and new to this environment. I've set up a class to share the state which I reset in beforeEach. But if possible I'd like to have the option of adding the World object which is available for Ruby and in Cucumber.js. Is there such a feature with jest-cucumber? Or what is the best practice here? Thanks in advance.
The text was updated successfully, but these errors were encountered:
The usual place for state being shared between steps is variables scoped to your defineFeature function. In many cases, steps are imported from other files, so there is no easy way to share state in that case. I can certainly see having something like Cucumber's "world", or SpecFlow's "scenario context".
@jakohans76 you should check out cucumber-jest. It's a transformer for jest that allows you to use the cucumber api, which already supports world context.
The usual place for state being shared between steps is variables scoped to your defineFeature function. In many cases, steps are imported from other files, so there is no easy way to share state in that case. I can certainly see having something like Cucumber's "world", or SpecFlow's "scenario context".
This is a reasonable solution when you use defineFeature.
However you can't do that when using autoBindSteps.
It can be really powerful if there could be a way to share state when auto binding steps.
I'm currently using jest and jest-cucumber with Typescript and new to this environment. I've set up a class to share the state which I reset in beforeEach. But if possible I'd like to have the option of adding the World object which is available for Ruby and in Cucumber.js. Is there such a feature with jest-cucumber? Or what is the best practice here? Thanks in advance.
The text was updated successfully, but these errors were encountered: