Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

generators/json

Generate a newline-delimited JSON report from result check outputs.

Prefer mkReport, which accepts checks in their natural shape; this generator takes the normalized form it produces.

Each line of the output is a JSON object with the following fields:

  • name: the attribute name of the check
  • suite: suite name, or null for flat checks
  • kind: the check type ("result", "snapshot", or "eval")
  • status: "pass", "fail", or "skip"
  • exitCode: the raw exit code string
  • stdout: captured stdout
  • stderr: captured stderr
  • drvPath: path to the check derivation in the Nix store
  • children: nested entries of the same shape, from passthru.children on the check derivation (a list of { name; check; }) — empty unless the check exposes any (snapshot checks expose their wrapped check as "actual")

kind reflects passthru.kind on the result check derivation. status is "skip" when passthru.skip is set (by mkSkip); a skipped check’s command output is never referenced, so it never builds, and exitCode/stdout/stderr are all empty strings. drvPath is still the real .drv path: computing it only requires instantiation, not a build.

Type

json :: AttrSet -> Derivation

Arguments

checks
Attribute set of { check, suite } pairs, keyed by entry key.

Example

pkgs.resultChecks.json.override { inherit checks; }