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

Handle output from hooks appropriately #732

Merged
merged 2 commits into from
Sep 11, 2014
Merged

Conversation

brasmusson
Copy link
Contributor

Update the legacy_formatter to pass messages and embeddings from hooks to formatters, just before
describing exceptions (if any) to formatters.

For instance the Pretty and HTML formatter currently print output from the before hooks after the first step, and output from the AfterStep/After hooks are delayed to the next step/scenario.

The big show stopper is that output from before hooks makes the JSON formatter crash ("[] not defined on NilClass") in the gherkin library. A similar problem when using Cucumber-JVM has already been identified: cucumber/gherkin#289

Pass messages and embeddings from hooks to formatters, just before
describing exceptions (is any) to formatters. Update the debug
formatter to also catch puts calls.
@mattwynne
Copy link
Member

Thanks for digging into this @brasmusson. It would be ace to get this fixed for 2.0, but I won't cry if we don't - it's new behaviour, not a regression. I play to start re-writing the formatters against the new core reporter API once we ship 2.0, so this kind of thing would definitely get fixed at that stage.

Then the JSON formatter will not crash on before hooks output.
TODO: Remove this fix when the JSON formatter (in the Gherkin library)
has been fixed.
@brasmusson
Copy link
Contributor Author

The fix in cucumber/common@02ab9c6 does not make the JSON output right, but the least wrong without making changes in the Gherkin library. And since Cucumber does not crash (exception propagated all the way up to main), it does not block this PR to be merged.

@brasmusson brasmusson merged commit 02ab9c6 into master Sep 11, 2014
@brasmusson brasmusson deleted the handle-output-from-hooks branch September 11, 2014 16:02
@brasmusson
Copy link
Contributor Author

v1.3.x does not handle output from hooks very well, with these changes v2.0 handles them, if not identically, equally good (or bad). Still these changes represent an improvement, previously the output from AfterStep and After hook seem to be lost altogether. I think this changes can be merged, and the Pretty and HTML formatters improved later (before or after the release of v2.0).

@lock
Copy link

lock bot commented Oct 25, 2018

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 Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants