fix(browser): wait for orchestrator readiness before resolving browser sessions by soconnor-seeq · Pull Request #10397 · vitest-dev/vitest (original) (raw)

Notes:

Ideally, include a test that fails without this PR but passes with it.

I can't (or couldn't think of how to) test this bug as it is a fairly specific timing issue. It would require somehow mocking Playwright, etc so that the connected event fired before / after the orchestrator being created + assigned to getBrowserState().orchestrator. I added unit test that simulate the behaviour in the session code.

It's really useful if your PR references an issue where it is discussed ahead of time. If the feature is substantial or introduces breaking changes without a discussion, PR might be closed.

Because this is just a bug fix is an issue needed?


I was also able to reproduce this (intermittently) on my local machine by using Linux's ulimit -n 302 && pnpm test (that 302 is probably very repo + OS specific mind you). No other resource pressure seemed to work to re-create it: nice, ionice, tasket, 10 concurrent runs, cgroup with CPU and memory limits, etc.