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

gherkin-js: Reverse GherkinDocument back to Feature #299

Closed
mlapeyre3 opened this issue Nov 5, 2017 · 6 comments
Closed

gherkin-js: Reverse GherkinDocument back to Feature #299

mlapeyre3 opened this issue Nov 5, 2017 · 6 comments

Comments

@mlapeyre3
Copy link

Summary

Hi there, I am using the gherkin library to parse a .feature file into a GherkinDocument.

const Gherkin = require('gherkin');
const parser = new Gherkin.Parser();
var gherkinDocument = parser.parse(feature);

I was wondering if there is a way to go back from a GherkinDocument object to a .feature string?

Expected Behavior

Something like:

var feature = parser.getFeature(GherkinDocument);

Current Behavior

I did not find any methods like this in the code.

Context & Motivation

It would be super nice to handle a getFeature() method. It's easier to handle the json-formatted GherkinDocument than a pure string like a .feature file.

Thanks !

@aslakhellesoy
Copy link
Contributor

I'd like to know in what this context this would be useful, and how this would be better than just reading the source from disk.

@mlapeyre3
Copy link
Author

Hi @aslakhellesoy ! Ok let me explain a bit more.

I am using

const Gherkin = require('gherkin');
const parser = new Gherkin.Parser();
var gherkinDocument = parser.parse(feature);

to parse a .feature file on server side and respond to my client application with a json-formatted GherkinDocument.

The client application can easily handle the Feature as a json object and manipulate the properties of the document (for display, editing, ...).

Now, let's say my application has an interface to add/remove tags of a given Scenario, and a button to export a .feature file back from the GherkinDocument.

It's easy to add the tag in the tags: [] property of the Scenario. However, I want to be able to format the GherkinDocument back to a .feature string so that the user is able to download a new .feature file.

I found https://www.npmjs.com/package/gherkin-assembler to fulfill my need but I have not tested it yet.

@stale
Copy link

stale bot commented Feb 17, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in a week if no further activity occurs.

@stale stale bot added the ⌛ stale Will soon be closed by stalebot unless there is activity label Feb 17, 2018
@aslakhellesoy
Copy link
Contributor

@mlapeyre3 is there anything missing from gherkin-assembler? If not I think we can close this issue.

@stale stale bot removed the ⌛ stale Will soon be closed by stalebot unless there is activity label Feb 17, 2018
@mlapeyre3
Copy link
Author

HI @aslakhellesoy, sorry I did not follow-up my latest post.
https://www.npmjs.com/package/gherkin-assembler did the job so you can close this issue :)

@lock
Copy link

lock bot commented Feb 19, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Feb 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants