js/commands/test

js/commands/test.ts

fino:commands/test — reusable fino test command task.

Builds the fino test command as a Task from fino:task, so the same command definition backs the root Fino CLI and can be mounted by any other interface (a custom CLI, a tool surface) that speaks the Task protocol.

Positional arguments may be direct files, directories, or glob patterns. Directories expand to every .test.ts file beneath them, globs are resolved from the current working directory, and direct files are taken as given. Each matched module is dynamically imported — describe() and it() calls at module top level register tests as a side effect — and then execution is delegated to run() from fino:test/test, which emits TAP output. With --parallel, each file runs in an isolated Realm and returns a structured result whose top-level entries are merged into the ordinary root TAP document. Top-level group execution defaults to ten groups per configured reactor thread. FINO_TEST_CONCURRENCY changes that per-reactor multiplier. At most one group executes per file Realm. A completed file admits the next file Realm into the bounded live window.

Parallel output remains TAP 13 and has the same top-level shape as serial execution. Completed groups emit atomically in completion order by default, preventing output interleaving without hiding progress behind an earlier long-running group. --ordered instead emits groups in deterministic registration order. Both modes enforce the same in-flight cap.

Before importing anything the command calls allowInternalForTests(), lifting the loader's internal:* import restriction so test files can exercise internal modules directly.

import testCommand from 'fino:commands/test';

// Run every test under tests/net whose describe path mentions "socket".
await testCommand.parse(['--filter', 'socket', 'tests/net']);

Constants

const command