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

Change Default DIrectory for stepDefinitions #311

Closed
weary-pilgrim opened this issue Jan 15, 2020 · 5 comments
Closed

Change Default DIrectory for stepDefinitions #311

weary-pilgrim opened this issue Jan 15, 2020 · 5 comments

Comments

@weary-pilgrim
Copy link

I had a problem finding my steps when I first upgraded to v2.0.1 because my cypress config is as follows:

{
  "fixturesFolder": "test/cypress/fixtures",
  "integrationFolder": "test/cypress/integration",
  "pluginsFile": "test/cypress/plugins/index.js",
  "screenshotsFolder": "test/cypress/screenshots",
  "supportFile": "test/cypress/support/index.js",
  "videosFolder": "test/cypress/videos"
}

I solved the problem adding this to my package.json:

  "cypress-cucumber-preprocessor": {
    "nonGlobalStepDefinitions": true,
    "stepDefinitions": "test/cypress/integration",
  }

I would love to see you change the default value for the step definition path to be the integrationFolder configured in cypress.json. I seems like you should be able to change this line of code from this:

const relativePath = confStepDefinitions || "cypress/integration";

to this:

const relativePath = confStepDefinitions || Cypress.config('integrationFolder');

But when I try that locally, it tells me that Cypress is not defined in the context where this code is executed. Is that why you're not using it in the first place?

@therussiankid92
Copy link

I might be interested in this solution, as this would allow me to update the directory of the stepDefinitions in a programatic way, via the Cypress Module API.

@lgandecki
Copy link
Collaborator

We don't have access to Cypress object so this is not possible. We used to have the default from the cypress config but we don't want to rely on config files that we don't own. Especially since now you can have the cypress config set through the CLI, which causes all sorts of different problems.

StepDefinitions path is something that you set once and forget, and if you ever change it in cypress config while forgetting updating the cypress-cucumber config, you will see an error that tells you exactly what's wrong, so I believe this is as good as we can get.

@csirkeee
Copy link

Isn't the config you get as a function parameter in cypress/plugins/index.js the fully resolved cypress config information? Couldn't you just pass that into your preprocessor function and get the integration folder from that?

@lgandecki
Copy link
Collaborator

Hmm I guess you could, but that's a backward incompatible change. It might be worth introducing a major version bump for this change if this helps a lot of people

@badeball
Copy link
Owner

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.

Read more about the transfer of ownership here.

The repository has however moved and all outstanding issues are being closed. This is not a reflection of the perceived importance of your reported issue. However, if after upgrading to the new version, you still find there to be an issue, feel free to open up another ticket or comment below. Please make sure to read CONTRIBUTING.md before doing so.

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