-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 asynchronous exceptions #51
Milestone
Comments
ghost
assigned jbpros
Mar 22, 2012
chirayuk
added a commit
to chirayuk/cucumber-js
that referenced
this issue
Oct 4, 2014
See angular/protractor#876 (specifically [my comment](angular/protractor#876 (comment))). Cucumber uses the top level uncaught error handler to catch exceptions caught by tests. Refer commit cucumber@9091129 and issue cucumber#51. A good approach would be to wrap the test code executions in try/catch blocks and use that exception instead of the `uncaughtException` handler. Another approach is to use the error handler of a nodejs domain instead of the top level global uncaughtException handler. In this commit, I'm using the domain level error handler approach.
chirayuk
added a commit
to chirayuk/cucumber-js
that referenced
this issue
Oct 4, 2014
See angular/protractor#876 (specifically [my comment](angular/protractor#876 (comment))). Cucumber uses the top level uncaught error handler to catch exceptions caught by tests. Refer commit cucumber@9091129 and issue cucumber#51. A good approach would be to wrap the test code executions in try/catch blocks and use that exception instead of the `uncaughtException` handler. Another approach is to use the error handler of a nodejs domain instead of the top level global uncaughtException handler. In this commit, I'm using the domain level error handler approach.
chirayuk
added a commit
to chirayuk/cucumber-js
that referenced
this issue
Oct 4, 2014
See angular/protractor#876 (specifically [my comment](angular/protractor#876 (comment))). Cucumber uses the top level uncaught error handler to catch exceptions caught by tests. Refer commit cucumber@9091129 and issue cucumber#51. A good approach would be to wrap the test code executions in try/catch blocks and use that exception instead of the `uncaughtException` handler. Another approach is to use the error handler of a nodejs domain instead of the top level global uncaughtException handler. In this commit, I'm using the domain level error handler approach.
chirayuk
added a commit
to chirayuk/cucumber-js
that referenced
this issue
Oct 4, 2014
See angular/protractor#876 (specifically [my comment](angular/protractor#876 (comment))). Cucumber uses the top level uncaught error handler to catch exceptions caught by tests. Refer commit cucumber@9091129 and issue cucumber#51. A good approach would be to wrap the test code executions in try/catch blocks and use that exception instead of the `uncaughtException` handler. Another approach is to use the error handler of a nodejs domain instead of the top level global uncaughtException handler. In this commit, I'm using the domain level error handler approach.
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. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Asynchronous exceptions are currently not caught: they interrupt Cucumber execution, print out the stack trace and end the process altogether.
It's possible to catch asynchronous exceptions on both Node.js and browsers through
process.on('uncaughtException', ...)
andwindow.onerror
, respectively.The catching function should call the current step
callback.fail()
function and pass it the caught exception so that Cucumber can report the failing step and proceed with the next scenario, if any.Interesting Fact™: this will be the first piece of code in Cucumber.js that needs branching depending on wether it's running on Node or a browser.
The text was updated successfully, but these errors were encountered: