You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test: fix pre-existing unit-test failures (green the suite)
Repair test rot and a harness bug in test/local.js so the suite runs to
completion and reports per-test results instead of aborting mid-run.
Harness fix:
- Assertions inside asynchronous callbacks (the tree-kill callback from
Local.stop, and the binary-download callbacks) run outside Mocha's
synchronous try/catch. A throw there escaped as an uncaught exception and
aborted the whole Mocha process, hiding every test that had not run yet.
Added a small `check(done, assertions)` helper that runs the assertions in
a try/catch and routes any failure through `done`, so a failing assertion
is reported as a normal test failure and the run continues.
Test rot fixed:
- LocalBinary.binaryPath gained a `bsHost` parameter
(conf, bsHost, key, parentRetries, callback), but the Retries specs still
called the old 4-arg form, so the callback landed in the wrong slot and was
never invoked -> the before() hook hung until its 10-minute timeout. Passed
the missing bsHost argument.
- The Retries spec asserted download() was called with a retry count of 5;
the default retry budget is now 9 (baseRetries). Updated the expectation.
- The "Download Path" specs called getDownloadPath() with the old synchronous
no-arg signature and asserted a hard-coded public URL. getDownloadPath is
now async and prefixes a dynamically fetched source URL; the OS/arch ->
filename mapping they were really validating now lives in
getBinaryFilename(). Rewrote them to assert getBinaryFilename() directly.
Left red on purpose (real product behaviour, not masked):
- "should stop local" asserts isRunning() === false immediately after
stop()'s callback fires. stop() now sends SIGTERM via tree-kill and calls
back as soon as the signal is dispatched, without waiting for the process
to exit or clearing its own pid/isProcessRunning state, so isRunning() stays
true for a few seconds. This is a genuine product race and is deliberately
left failing rather than weakened.
No production code changed.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
0 commit comments