Closed cmw9706 closed 3 years ago
In the event that anyone else ended up here with the same issue, here is my solution. Turns out I just didn't read enough of the cucumber cli documentation and tbh I'm not sure I think its very well described but, cucumber-js
takes a positional argument defining the location of your feature directory and it takes a --require
argument defining the location of your step-definitions.
The script I ended up running to get this to work looks like this,
cucumber-js tests/e2e/features --require-module @babel/register --require cucumber.conf.js --require tests/e2e/step-definitions
I have a project that I am using nightwatch api and cucumber with. Currently the locations of my
nightwatch.conf.js
,cucumber.conf.js
,step-definitions/
,andfeatures/
are all in my root dir of my project. I can run my test using the scriptcucumber-js --require-module @babel/register --require cucumber.conf.js --require step-definitions
and everything runs as expected.
I would like to be able to put my step definitions/ and my feature/ directories to a e2e/ directory and achieve the same results. However this seems to not work.
Whenever I most my directories to
myproject/tests/e2e/
, i tried modifying the required directory to match, so now my script looks like thiscucumber-js --require-module @babel/register --require cucumber.conf.js --require ./tests/e2e/step-definitions
But now the CLI output just says 0 scenarios found.
I have also tried setting the
src_folder
property in thenightwatch.conf.js
and have this didn't work either. Any help would be greatly appreciated.Expected Behavior
I can put my step definitions and feature directories somewhere other than the root directory and they will be recognized when I run my test
Current Behavior
The step definitions and feature directories must be at my root directory for them to be recognized by the cucumber command