function record
record(
config: Config,
): void

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.

No-op when the state slots are absent (unit-test configs built without run state).

import * as FailureCache from './failure-cache.ts';

import type { Config } from '../types.ts';

// Defined, not invoked: reads and mutates the live run state on Config.
function onTestEnd(config: Config, details: { fullName: string[] }) {
  FailureCache.record(config, details); // failure lands in state.results.{failedFiles,failedTests}
}

Parameters

Return Type

void

Usage

import { record } from "lib/utils/failure-cache.ts";