Assembles the cache payload from the shared per-run failure slots on config.
Resolves the concrete previously-failing test files to re-run for --only-failed. Returns
null when no cache exists (the caller picks the fallback — run all, or a full watch start).
Otherwise returns the cached files that still exist, intersected with fsTree when input
targets were given (so failures stay scoped to what the user asked for) or the full cached set
when no targets were provided. Shared by the non-watch fsTree filter and the watch initial run.
Reads the failure cache; returns null on a missing file or any parse/shape error.
Records a failed testEnd into the shared per-run slots (state.results.failedFiles / failedTests)
used to build the persistent cache. The failing file is attributed via source-map resolution
of the first failing assertion's stack; when that can't be resolved to one of the run's test
files (timeouts, no stack, a frame in a shared helper), the whole run/group set is added so a
failure is never dropped from --only-failed.
Writes the failure cache. Best-effort; callers fire-and-forget like Timings.persist.
One failed test, kept for display and future -t (test-name filter) wiring.
-
file: string | null
Source file the failure was attributed to (relative to projectRoot), or
nullwhen unattributable. -
module: string
QUnit module path,
>-joined;''for a top-level test. -
testName: string
The test's own name.
On-disk shape of tmp/.qunitx-last-failures.json.
-
browser: string
Browser engine the failures were observed in.
-
files: string[]
Absolute paths of test files that contained at least one failure — drives
--only-failed. -
tests: FailedTestRecord[]
Per-test metadata for the failures above.
Usage
import * as mod from "lib/utils/failure-cache.ts";