Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Commit 6626ce7

Browse files
authored
fix(launcher) Ignore uncaught exceptions from webdriver. (#3608)
1 parent ef72882 commit 6626ce7

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

lib/config.ts

+6
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,12 @@ export interface Config {
457457
*/
458458
untrackOutstandingTimeouts?: boolean;
459459

460+
/**
461+
* If set, Protractor will ignore uncaught exceptions instead of exiting
462+
* without an error code. The exceptions will still be logged as warnings.
463+
*/
464+
ignoreUncaughtExceptions?: boolean;
465+
460466
// ---------------------------------------------------------------------------
461467
// ----- The test framework
462468
// --------------------------------------------------

lib/launcher.ts

+7
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,13 @@ let initFn = function(configFile: string, additionalConfig: Config) {
185185

186186
process.on('uncaughtException', (exc: (Error|string)) => {
187187
let e = (exc instanceof Error) ? exc : new Error(exc);
188+
if (config.ignoreUncaughtExceptions) {
189+
// This can be a sign of a bug in the test framework, that it may
190+
// not be handling WebDriver errors properly. However, we don't
191+
// want these errors to prevent running the tests.
192+
logger.warn('Ignoring uncaught error ' + exc);
193+
return;
194+
}
188195

189196
let errorCode = ErrorHandler.parseError(e);
190197
if (errorCode) {

0 commit comments

Comments
 (0)