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

Set timeout in formatter events #641

Closed
szikszail opened this issue Sep 21, 2016 · 9 comments
Closed

Set timeout in formatter events #641

szikszail opened this issue Sep 21, 2016 · 9 comments

Comments

@szikszail
Copy link

szikszail commented Sep 21, 2016

Hi,

I have implemented a custom formatter for cucumber, what pushes the results to a service. But it might take more time than the previously set default timeout. I know that when we use registerHandler method, we can set other timeout, but what is the case with Event functions:

const formatter = require('cucumber').Listener.Fomatter({});
formatter.handleAfterFeaturesEvent = function () {
  // some action which definitelly takes more time than defaultTimeout
};

Is there any way how I can modify timeout in this case?

@charlierudolph
Copy link
Member

charlierudolph commented Sep 21, 2016

When creating a listener/formatter you can pass in an options with a timeout in order to specify the timeout for all actions. There is no current way to specify the timeout for individual actions.

const formatter = require('cucumber').Listener.Fomatter({timeout: 5 * 60 * 1000});

This isn't documented as custom formatters aren't documented, but I will be adding better support and documentation for them soon.

@szikszail
Copy link
Author

szikszail commented Sep 26, 2016

@charlierudolph does this configuration option work?
I have checked the source of formatter.js and didn't found where timeout passed to listener where it's used.
It should be somewhere here: https://github.com/cucumber/cucumber-js/blob/master/lib/cucumber/listener/formatter.js#L9

@charlierudolph
Copy link
Member

Auhh okay. Looks like options would need to be passed into Listener for this support to be added.

@szikszail
Copy link
Author

And do you plan to fix this and add support in the near future?

@charlierudolph
Copy link
Member

I'm working on 2.0 now which will include docs on custom formatters. That probably won't be out for a month or so. If you'd like this earlier and could make a PR just updating the formatter to pass its options into the listener constructor on the line you pointed out, I'm happy to merge it and release a new version for you.

@szikszail
Copy link
Author

It would be very cool to include this in the next release! Thank you!

@charlierudolph
Copy link
Member

Fixed in just released 1.3.1

@szikszail
Copy link
Author

Thank you!

@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

No branches or pull requests

2 participants