protractor: Option to disable uncaughtException listener

Please add an option to disable the uncaughtException listener from lib/launcher.ts:182 since it interferes with Cucumber as described in #3491.

Quick recap: Protractor’s uncaughtException listener registers first so it’s fired before Cucumber’s listener for the same event, which would normally handle whatever error occurred inside a step definition and gracefully fail the step. Which in turn leads to Protractor exiting the suite at the first exception (which could be, for example, a failed assertion).

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 19 (10 by maintainers)

Most upvoted comments

I take that back! It is a problem on our end… kind of. The mocha and jasmine frameworks both have wrappers that handle exceptions - jasminewd for jasmine and the Mocha wrappers in selenium-webdriver. There’s no such wrapper for cucumber, so we’ve actually never handled webdriver errors, it’s just never been an issue since we ignored uncaught exceptions in the past.

It’s actually a little surprising cucumber works at all without a webdriver wrapping, but I guess the pattern of putting all your expectations in a “Then” block means all the WebDriver ControlFlow promises will be resolved by the time you check for things.

In any case, this will be fixed in the next point release. Sorry for the breakage.

Ah, that makes sense. Found it in the lib/config.ts although I think the comments there could be expanded a bit to impress the importance of this at least for people using cucumber-protractor framework.

(update) having set ignoreUncaughtExceptions: true in the config file, I am now able to run a test suite that was previously failing due to an uncaught exception all the way through without the test run crashing. The scenarios with the exception(s) fail as would be expected, and we get test results for the run instead of nothing but the console feedback.

Hi Guys, Do we have any info about that release which will include this fix?

The fix should be included in the next patch release, probably sometime next week.

This seems to be an issue! I am aware that uncaught exception event is triggered before the cucumber listeners which is why the steps are failing abruptly incase of errors.

Note : It works fine with Protractor 3.3.0 and uncaught exception was added from 4.0, so I won’t say it’s a blocker as of now, you could downgrade and check if it works for you.

Meanwhile, There should be an alternative for this to support with newer versions of protractor! @NickTomlin @cnishina any suggestions?