[engine] PurityLint: Load ESLint once in beforeAll so a cold start under load cannot time out the first case
This commit is contained in:
@@ -58,3 +58,18 @@ arrives. Then it fails for the first time on the author's machine, with the auth
|
||||
|
||||
**How to apply it.** When a test branches on content that does not exist yet, fill the
|
||||
content temporarily, run the suite, restore it, and record the run in the review.
|
||||
|
||||
## A one-time cold start is charged to the first case
|
||||
|
||||
**What happened.** On 2026-11-01, with the machine at 80% CPU, `pnpm test` failed one engine
|
||||
case: `purity-lint.test.ts` › *reports Date.now()*, timed out at 5 s. The snippet was fine.
|
||||
The first `eslint.lintText` call loads the whole config and typescript-eslint, and vitest
|
||||
charged that load to whichever case ran first. The fix is a `beforeAll` that lints an
|
||||
empty file once, with its own 60 s timeout.
|
||||
|
||||
**Why it bit.** A suite that passes on a quiet machine can still hide a fixed cost inside one
|
||||
case. It fails only under load, and then it looks like a bug in the code that case tests.
|
||||
|
||||
**How to apply it.** When the first case of a file loads something heavy (a linter, a
|
||||
compiler, a browser), load it in `beforeAll` with an explicit timeout. If only the first case
|
||||
of a file times out, suspect a cold start before suspecting the code.
|
||||
|
||||
Reference in New Issue
Block a user