IF Commons GitHub

sql/extensions/assertions/tap

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0049-sql-assertions FR-004

The Test Anything Protocol, version 14, as typed values (commons data 0049-sql-assertions FR-004): the one format the results of assertions are reported in. Results are data first; tapText writes them.

Source: commons/data/sql/extensions/assertions/tap.ts

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

Diagnostictypeno test imports it
type Diagnostic = string | number | boolean | null | readonly Diagnostic[] | { readonly [key: string]: Diagnostic };

A value a diagnostic block may hold.

Directivetypeno test imports it
type Directive = { readonly kind: "skip"; readonly reason: string } | { readonly kind: "todo"; readonly reason: string };

Why a test was not counted as it ran.

failedconst
const failed: (description: string, diagnostics?: { readonly [key: string]: Diagnostic; } | undefined) => TapNode

A failing test, with what was found.

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

fromLinesfunction
function fromLines(lines: readonly string[]): readonly TapNode[]

Reads the test lines a database gave back (as the SQL that returns TAP lines does) into results.

ParameterWhat it is
lineslines such as ok 1 - party exists and not ok 2 - ...; others are kept as comments

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

passconst
const pass: (description: string, subtests?: readonly TapNode[] | undefined) => TapNode

A passing test.

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

skippedconst
const skipped: (description: string, reason: string) => TapNode

A test that was not run, and why.

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

tallyfunction
function tally(nodes: readonly TapNode[]): { readonly passed: number; readonly failed: number; readonly skipped: number; }

How many tests of a document passed, failed and were skipped: a test with a directive is not a failure.

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

TapNodetypeno test imports it
type TapNode =
  | {
      readonly kind: "test";
      readonly ok: boolean;
      readonly description: string;
      readonly directive?: Directive;
      readonly diagnostics?: { readonly [key: string]: Diagnostic };
      readonly subtests?: readonly TapNode[];
    }
  | { readonly kind: "comment"; readonly text: string }
  | { readonly kind: "bail"; readonly reason: string };

One line of a TAP document.

tapTextfunction
function tapText(nodes: readonly TapNode[]): string

Writes results as a TAP version 14 document.

ParameterWhat it is
nodesthe results, in order
tapText([pass("party exists"), failed("person has 5 columns", { found: 4 })]);

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

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