cypress-cucumber-preprocessor: fileServerFolder option is being used incorrectly
First off, I would like to show my appreciation for this project, it’s something that I’ve been looking for for a while now, and I’m glad you open sourced it!
The issue is that the fileServerFolder
option is being used incorrectly to look for step definitions, when it actual use case is to allow cypress
to start a local http static assets folder from this path.
I’ve created a PR here #17
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 15 (2 by maintainers)
Commits related to this issue
- Merge pull request #35 from TheBrainFamily/usingAnd Fixing #31 #30 #28 #16 — committed to badeball/cypress-cucumber-preprocessor by lgandecki 6 years ago
@lgandecki sure, the default path of installation of cypress is in the root of the project, but for me, that default doesn’t match my current scaffolding. This is directory structure:
So, in my case, i don’t want to keep a cypress folder polluting the root of the project. But, this plugin has the directory /cypress/support/ hardcoded, so, what i try was just to make this module to be aware of the custom directory cypress folder.
But, if we can add to cypress.json a specific value to our step_definition folder, that should be great.
Another way is adding a custom config to the package.json file adding the route of our step definition files.
quick update - if the cypress guy don’t reply by the middle of next week I will implement it in cypress.json with the syntax proposed by @reaktivo
@brian-mann is there a best practice for defining plugin configs? I would rather read the both the cypress config and it’s plugins from the same file. And considering we have access to the parsed config at plugin loading time, we might as well pass that config:
in my
cypress.json
file:Yesterday I played around with some different solutions
cypressCucumber
key tocypress.json
I gave this idea a try and it kind of felt prone to error. Considering cypress config options may also be passed via env variables, cli
--config
flags, etc, havingcypress-cucumber-preprocessor
read the config json file directly without taking into account the previously mentioned sources of config feels like the wrong way to go.I found out Cypress whitelists the properties that will be included in that config object, what I mean that adding a
"something": "value"
into yourcypress.json
won’t include it in theconfig
argument passed to the plugin configuration function. Also, some refactoring would need to happen so we appendbrowserifyOptions
instead of overwriting them.cypress-cucumber.json
at project root level Although not ideal, it works in a predictable way and is guaranteed to be compatible with future cypress versions.P.D As a temporary solution for those wanting to define
fileServerFolder
without your step definitions path incorrectly set, you can simply pass it as a cli option, and it will be ignored by thecypress-cucumber-preprocessor
plugin.@lgandecki that was the case.
In this scenario, i’ll vote for a package.json configuration, like the custom configurations for “jest” or “nightwatch”.
If you rename all of the cypress folders per configuration it should/will not create a
cypress
folder.https://docs.cypress.io/guides/references/configuration.html#Folders-Files
yeah, that could make sense… I wish we had some feedback from the cypress guys here… @brian-mann @bahmutov what do you think of us (or other plugins) adding custom properties to the cypress.json ?