Five tests that timed out on a busy machine now pass there

For each test I checked whether the code under test was slow or only the test's time limit was too tight. Two causes were in the code, and fixing them makes real use faster too. The rest was the tests' own setup and cleanup work.

What each failure came from

TestCauseFix in
Scrollbar test, silent speech test (hooks timed out after 30 s)Chrome's own shutdown hangs on a busy Mac until its built-in watchdog ends it about 10 s later. Playwright waited for that. A demo waited the same way after its login and after its take.code
Browser skill (found along the way, timed out once)Same hang: stop asked Chrome directly to close, then waited up to 10 s.code
App bundle install (5 s limit)lsof, which checks whether an old bundle still runs, looked up host and port names for every network connection on the machine on every call. The test calls it five times.code + test
Large demo directory (cleanup hook)The sweep itself is fine. Deleting the test's 9,000 fake files afterwards took more than 5 s.test
Demo setup check (5 s limit)The test writes fake node/ffmpeg programs. macOS checks a newly written program before its first run. The real check runs installed programs, so only the test pays for this.test
Large canvas (setup hook, found along the way)Setting up 1,300 cards with demo folders took more than 5 s.test

Closing a browser, before and after

Before
6.6 – 9.7 s
After
2.05 s

Six closes each, alternating, with six busy processes running. Every browser the plugin starts now gets 2 s to close on its own. After that its processes are killed and its throwaway profile is removed. A new test freezes a browser and checks that it still goes.

Asking lsof, before and after

Before
0.6 s
After
0.14 s

One call, measured under the same load. With the whole test suite running beside it, one call took 1.4 s before.

The whole suite under load

Before (other cards were busy too)
✕
✕
✕
Browser and lsof fixes only
✕
✕
✓
✓
All fixes
✓
✓
✓
✓

Each run is bun test --parallel beside six busy processes (yes > /dev/null). Other cards' agents were working on the machine at the same time, with load averages of 30 to over 100, a much heavier load than the card asked for. At that load some git-heavy server tests also timed out, in the "before" runs and in the first run with only part of the fixes. None of them failed in the last four runs.