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

Add a cucumber-js parser #67

Merged
merged 1 commit into from
Apr 26, 2024
Merged

Add a cucumber-js parser #67

merged 1 commit into from
Apr 26, 2024

Conversation

kylekthompson
Copy link
Member

@kylekthompson kylekthompson commented Apr 26, 2024

It's worth noting that technically they've deprecated their JSON format insofar as they don't intend to add new features to it.

It is however MUCH easier to parse than their JSONL messages format (which seems to intend for you to construct a graph of their objects as messages come through).

I named this parser w/ JSON in it to leave room for a future messages format parser, but this was really quick to add and unblock anyone interested in using Captain with cucumber-js

If anyone is hesitant to use the JSON formatter for this reason, it looks like they also support JUnit and the generic JUnit parser should be able to parse that

@kylekthompson kylekthompson self-assigned this Apr 26, 2024
@@ -30,7 +30,6 @@ var mutuallyExclusiveParsers []parsing.Parser = []parsing.Parser{
new(parsing.JavaScriptMochaParser),
new(parsing.JavaScriptPlaywrightParser),
new(parsing.PythonPytestParser),
new(parsing.RubyCucumberParser),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not mutually exclusive. Technically a breaking change, but I no one (other than us testing the integration) has used Ruby Cucumber. Checked if this is ok w/ Tommy

The outcome is you need to specify language and framework

} `json:"elements"`
}

func (p JavaScriptCucumberJSONParser) Parse(data io.Reader) (*v1.TestResults, error) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is mostly a copy of the logic in Ruby Cucumber, but a slight tweak to the before/after hook logic which ends up in Steps in the JS version instead of a separate field in the struct

@kylekthompson kylekthompson merged commit 097fe17 into main Apr 26, 2024
23 checks passed
@kylekthompson kylekthompson deleted the kt/cucumber-js branch April 26, 2024 13:21
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

Successfully merging this pull request may close these issues.

None yet

2 participants