feature fixes

This commit is contained in:
pj committed 2026-08-28 16:08:39 +05:30
1 parent 1b31e2f189
commit 586ee946d0
38 files changed
+1938 -260

No files matched your search

+30
View File
@@ -37,5 +37,35 @@ export default defineConfig({
test: {
include: ["src/**/*.test.ts"],
environment: "node",
// The markdown suites are thousands of generated documents pushed through the writer inside one
// synchronous loop, and the worst of them holds a worker's event loop for the better part of
// half a minute even on a fast machine. Everything below exists because of that.
//
// A worker tells the main process about each test it starts, over an RPC call it then waits on,
// and that call is given sixty seconds before it gives up with `Timeout calling "onTaskUpdate"`.
// A test that blocks the loop cannot take delivery of the answer while it is running, so what
// the sixty seconds really bounds is the length of the slowest single test, not the round trip.
// Vitest does not expose that timeout, so the only lever left is keeping the tests from getting
// slower, and what makes them slower is contention. The default is one worker per core bar one,
// which on a two or three core hosted runner has the heaviest suites fighting each other and the
// main process for the same cores. Half the cores gives each worker a core to itself and still
// leaves one for the main process to answer on. This is a percentage rather than a number
// behind a CI check because it lands on the right answer for a two core runner, a three core
// one and a developer's laptop without anyone having to know which one the job got, and it
// costs nothing locally: the run is bounded by its slowest single file either way.
maxWorkers: "50%",
// Five seconds is the default and nothing in the markdown suites honours it. The slow tests
// pass their own timeout to `it` as a third argument. The merely slow-ish ones do not, and they
// are the ones that go red on a loaded runner having done nothing wrong. Thirty seconds is what
// most of the annotated tests already ask for, and it stays under the sixty the RPC allows, so
// this cannot itself cause the failure described above.
testTimeout: 30_000,
hookTimeout: 30_000,
// How long a worker is given to shut down before it is killed. Ten seconds is plenty when the
// machine is idle and is not when several forks are all winding up at once.
teardownTimeout: 30_000,
},
});