This cli tool scans specifed folder for BDD feature spec files, written in Gherkin, converts them to another format, and outputs the converted data into a specified file.
The package defines gherkin
as a peer-dependency, so you need to install it separately in your project.
The package is published in Github packages. Follow the instructions in Github to authenticate yourself to GH packages & how to install the package from there.
Provide the generator command with a path containing the feature spec files, and the desired output filepath for the generated data.
Example:
bdd-to-md --featuresPath features --outputFilePath FEATURES.md
or, by using aliases in arguments
bdd-to-md -f features -o FEATURES.md
Example, using custom conversion type:
bdd-to-md --featuresPath features --outputFilePath plain.txt --conversionType my-custom-conversion-type
or, by using aliases in arguments
bdd-to-md -f features -o plain.txt -c my-custom-conversion-type
Despite the project name stating sole capability of converting BDD to MD, the project structure allows to extend the capabilities to custom formats too. If you fork the repo, and want to add more conversion capabilities, you can add your custom converters as follows:
- add new conversion producer module in folder
generate-docs/convert/producers
- export a public function named
produceFrom
from the producer module - have the function accept a
gherkinDocument
(see https://github.com/cucumber/common/tree/main/gherkin) as an argument - export the new conversion producer module in the
generate-docs/convert/producers/index.js
- use the producer by providing the exported key name in the
conversionType
cli argument
When in doubt, take a look in the generate-docs/convert/producers
directory, how the md
producer is implemented and exported in the producers module.