Skip to content

pglite-absence's re-import test runs a cold instrumented ORM import on the default 5s timeout #1291

Description

@borisno2

Surfaced on PR #1281, 2026-09-07. Targets prisma-8, not main.

Symptom

FAIL src/testing/pglite-absence.test.ts > the optional peers are reached only lazily
  > a missing PGlite install is reported by name, with both remedies
Error: Test timed out in 5000ms.

Observed duration: 5132ms against a 5000ms budget — over by 2.6%.

Why this is environmental, not a real regression

  • It failed only in test:coverage. The same commit passed the same test in the uninstrumented test run (core: 1603 passed, 0 failed).
  • The runner was heavily loaded on the failing attempt: src/db/dev-database.test.ts took 112s and total import time was 91.91s.
  • The PR it fired on modified src/testing/context.ts — the module this test dynamically re-imports — but the change is documentation only. The import list is byte-identical before and after, so the module graph did not get heavier.

Why it will keep happening

The test does vi.resetModules() and then a fresh dynamic import('./context.js'), which re-imports a heavy graph including @prisma/orm-postgres/runtime and /control, with coverage instrumentation applied. It runs on the default 5s timeoutpackages/core/vitest.config.ts sets no testTimeout.

So the budget for a cold instrumented re-import of the ORM runtime is the same 5 seconds as for a trivial unit test, and it currently lands within ~3% of that ceiling. Any loaded runner tips it over. This will recur on unrelated pull requests and cost a full re-run each time.

Note this is a different mechanism from #1284: that one is an assertion failing on a real invariant, and its fix must not be a timeout bump. This one is a genuine budget mismatch, where the test's subject is an error message rather than latency.

What to build

  • The test's timeout reflects what it actually does — a cold, instrumented re-import of the ORM runtime — rather than inheriting the default
  • Or the re-import is made cheap enough that the default budget is honest (e.g. narrowing what resetModules forces to reload)
  • The assertion itself is unchanged: it must still prove a missing PGlite install is reported by name with both remedies
  • Check the sibling tests in the same file for the same latent mismatch

Do not fix this by removing the assertion or by skipping the test.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agentFully specified, ready for an AFK agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions