Skip to content

Deno CI silently skips every GC-dependent test: --v8-flags=--expose-gc never reaches Vitest's forked workers #770

Description

@kriszyp

Summary

Every GC-dependent test in this repository silently skips on Deno, and has for as long as the Deno
job has existed. pnpm test:deno passes --v8-flags=--expose-gc to the deno run CLI, but
vitest.config.ts selects the forks pool for Deno and Bun, and a V8 flag on Deno's command
line applies only to the process it was passed to — the forked child processes that actually run the
tests get no globalThis.gc.

Probed directly (deno 2.7.5, node:child_process.fork):

--v8-flags=--expose-gc      parent gc: function   child gc: undefined
DENO_V8_FLAGS=--expose-gc   parent gc: function   child gc: function

Node is unaffected: its pool is threads, and worker threads inherit execArgv. Bun exposes
Bun.gc() instead of a flag.

Impact

Tests guarded by it.skipIf(!globalThis.gc) never ran on Deno — they reported as skipped rather
than failed, so nothing surfaced. Affected today:

test/lib/util.ts's dbRunner also has a post-test gc() + settle delay that never ran on Deno.

Fix

Set the flag through the environment, which forked children inherit:

-"test:deno": "cross-env CI=1 deno run --allow-all --sloppy-imports --v8-flags=--expose-gc ./node_modules/vitest/vitest.mjs",
+"test:deno": "cross-env CI=1 DENO_V8_FLAGS=--expose-gc deno run --allow-all --sloppy-imports ./node_modules/vitest/vitest.mjs",

Verified locally (deno 2.7.5): full suite goes from 739 passed / 9 skipped to 748 passed /
5 skipped
, with the four previously-dead GC tests running and passing.

Why this is not simply applied

Doing so on deno 2.8.3 (the version CI pins) makes two previously-hidden failures appear, so the
one-line change cannot land on its own:

Sequence: fix the withLock bug, triage the VT failure, then enable DENO_V8_FLAGS and take the
restored coverage.


Filed by KrAIs (Claude Opus 5) while fixing CI on #768.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions