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

Reverse GherkinDocument back to Feature #131

Closed
jdavidrsantos opened this issue Jul 7, 2023 · 1 comment
Closed

Reverse GherkinDocument back to Feature #131

jdavidrsantos opened this issue Jul 7, 2023 · 1 comment

Comments

@jdavidrsantos
Copy link

Hi there, I am using the gherkin library to parse a .feature file into a GherkinDocument.
// JavaScript
var Gherkin = require('@cucumber/gherkin')
var Messages = require('@cucumber/messages')

var uuidFn = Messages.IdGenerator.uuid()
var builder = new Gherkin.AstBuilder(uuidFn)
var matcher = new Gherkin.GherkinClassicTokenMatcher() // or Gherkin.GherkinInMarkdownTokenMatcher()

var parser = new Gherkin.Parser(builder, matcher)
var gherkinDocument = parser.parse('Feature: ...')
var pickles = Gherkin.compile(gherkinDocument, 'uri_of_the_feature.feature', uuidFn)

I'll like to be able to save the file ast back as a feature but I can't find any function that allows me to do so.

@mpkorstanje
Copy link
Contributor

You might find some useful code in https://github.com/cucumber/gherkin-utils

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

2 participants