browserstack/jest-js-browserstack

browserstack-node-sdk afterAll timeout exceeded

kputnins opened this issue · 3 comments

When using browserstack-node-sdk with Selenium and NodeJS integration, the SDK adds it's own afterAll() jest hook with a timeout of 10000ms (10seconds).

In my case when running any kind of tests (or even no tests) this timer gets exceeded so jest exits with error code even thoug all of the tests passed.

This timeout can't be increased by configuring jest as it is a argument passed to the afterAll() hook inside the SDK, so it takes precedence over other jest configurations

Please increase this timeout or provide a way to increase it

You can use idleTimeout capability in the SDK itself. To get more info on the same, refer to this documentation

Hi @vikrantd1203, the idleTimeout is for BrowserStack to terminate the session if a driver.quit event was not received and has no effect on the jest hook timeout the SDK adds.

This is the hook and the timeout I'm talking about
image

It is a hardcoded value of 1000 (hexadecimal) that takes precedence of any other jest timeout configuration as it is inlined

Here is the same hook formatted
image

I have no idea what it does as I can't find any readable source code for the SDK, but if I manually increase the value in the node_modules file I get rid of the exception jest is throwing (any jest exceeded timeout throws and makes the process exit with an error)

This is how the jest error looks with 100% passing tests (I manually set the timer to 420ms so it would be a guaranteed fail)
image