[driver] errors thrown from test:before:run are incorrectly handled
Current behavior
Errors thrown from test:before:run handlers are not propagated correctly and cause inconsistent behaviors in run vs open mode.
- in open mode: the error is reported for each test
- in run mode: the error is swallowed, no tests start and Cypress hangs indefinitely
This failure occurs here in which the runner will catch the error here, however since the runnable has not been set the runnable (hook or test) technically hasn't officially starts which I think it causing the inconsistency with the finally handler which is in place to try to log the test results/errors and ensure the after:test:run and after:test:run:async events are emitted.
Desired behavior
When errors thrown from test:before:run handlers, reports it correctly and consistently between run/open mode without hangs.
Test code to reproduce
https://github.com/cypress-io/cypress-test-tiny/compare/verify-unhandled-err
CI job which timed out: https://ci.appveyor.com/project/cypress-io/cypress-test-tiny/builds/44331388
Cypress Version
10.3.1
Other
No response
The code for this is done in cypress-io/cypress#23226, but has yet to be released. We'll update this issue and reference the changelog when it's released.
Released in 10.5.0.
This comment thread has been locked. If you are still experiencing this issue after upgrading to Cypress v10.5.0, please open a new issue.