feat: Allow passing arguments to test script (issue #88) #103
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As per issue #88
Background: Recently the npm repo
cucumber-nightwatch
was deprecated in favour ofnightwatch-api
, whose example for how to use CucumberJs with Nightwatch involves usingstart-server-and-test
. What the example does not account for thatcucumber-nightwatch
supported though was passing arguments to Cucumber for tags, targeting feature files, etc.This limitation was due to the passing-arguments feature not yet implemented in
start-server-and-test
. I'm currently working on a project where we need to update nightwatch to a version that the oldcucumber-nightwatch
does not support, so I needed something that works and took on this issue.Their example: https://github.com/mucsi96/nightwatch-api/tree/master/examples/cucumber
I opened an issue on their end as well: mucsi96/nightwatch-api#24
I've tried my best to copy the style of the repo, hopefully it is up to par!
Usage:
Assuming:
npm run test -- --tag mytag
would pass
-- --tag mytag
to thetest:run
script, which would runmy-test-runner --tag mytag
.I've kept in the convention of
--
as a requirement for this to run correctly as it seems to be how passing arguments to other scripts is typically handled. There's other ways to do this as well, but this is what better matched what we had previously.Thanks for this repo!