IF Commons GitHub

host/trace

The runtime's part of trace and layers (commons 0015-trace FR-011): it reads the files the kernel's checks judge (kernel/trace.ts, kernel/layers.ts) and holds their findings against a baseline file. A harness's tool calls it and prints the lines it gives; it prints nothing itself.

import * as t from "../trace.ts";
import { holdBaseline, readSources, readSpecs } from "./trace.ts";
const root = ".";
const findings = t.traceFindings({
  specs: await readSpecs(root, "specs"),
  sources: await readSources(root, ["src"]),
  tests: await readSources(root, ["tests"]),
  ontology: [],
});
const held = await holdBaseline({ root, file: "tools/trace.baseline.txt", findings, name: "trace" });
for (const line of held.lines) console.log(line);

Source: commons/mizan/src/host/trace.ts

4 of 6 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

readSpecsfunction
function readSpecs(root: string, folder?: string): Promise<readonly Spec[]>

The specifications of a folder (<folder>/NNN-slug/spec.md, and reviewed.tsv where there is one), in the order of their names.

Imported by 2 tests of the run (2 passed, 0 failed): the library's results

posixPathfunction
function posixPath(p: string): string

A relative path with / between its parts, whatever the system's separator (FR-011).

Imported by 2 tests of the run (2 passed, 0 failed): the library's results

readSourcesfunction
function readSources(root: string, roots: readonly string[], suffixes?: readonly string[]): Promise<readonly SourceFile[]>

The files under roots (folders or files, from root) whose names end in a suffix (.ts by default), leaving out node_modules, by path from root with /.

Imported by 2 tests of the run (2 passed, 0 failed): the library's results

HoldOptionstypeno test imports it
type HoldOptions = {
  readonly root: string;
  readonly file: string;
  readonly findings: readonly Finding[];
  readonly name: string;
  readonly write?: boolean;
  /** The comment lines a written baseline begins with. */
  readonly comments?: readonly string[];
};

What holdBaseline is given: the repository, the baseline file (from it), the findings, the check's name, and whether to write.

Heldtypeno test imports it
type Held = { readonly code: 0 | 1; readonly lines: readonly string[] };

The lines to print and the exit status of a check held against its baseline.

holdBaselinefunction
function holdBaseline(o: HoldOptions): Promise<Held>

Findings held against a baseline file (FR-002, FR-003, FR-011), or, with write, the baseline written from them.

Imported by 2 tests of the run (2 passed, 0 failed): the library's results

Titles, headings, exports, tables, columns and requirements. Esc closes.