function classifyRunOutcome
classifyRunOutcome(
result: QUnitResult | null | undefined,
doneReceived: boolean
): BrowserRunOutcome

Classifies a finished browser run.

doneReceived is the load-bearing signal. QUnit fires done even for a file with no tests, so a zero-test tally with a done is a genuinely empty file. But the injected runtime pre-initialises window.QUNIT_RESULT to a zero tally at page load, so a run that timed out before tests.js executed also reads totalTests === 0without a done. Treating those two identically is what let a CPU-starved timeout on CI pass silently as an empty, exit-0 run (v0.31.0 windows-latest --coverage). The done flag tells them apart.

const tally = { totalTests: 3, finishedTests: 3, failedTests: 0, currentTest: null };
classifyRunOutcome(tally, true); // { kind: 'completed' }
classifyRunOutcome({ ...tally, finishedTests: 2, currentTest: 'slow test' }, true); // { kind: 'stalled' }
classifyRunOutcome({ ...tally, totalTests: 0 }, true); // { kind: 'empty' } — done with 0 tests
classifyRunOutcome({ ...tally, totalTests: 0 }, false); // { kind: 'no-tests-ran' } — a timeout

Parameters

result: QUnitResult | null | undefined
doneReceived: boolean

Return Type

Usage

import { classifyRunOutcome } from "lib/commands/test/tests-in-browser.ts";