Diagnostictypeno test imports ittype Diagnostic = string | number | boolean | null | readonly Diagnostic[] | { readonly [key: string]: Diagnostic };A value a diagnostic block may hold.
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.
Diagnostictypeno test imports ittype Diagnostic = string | number | boolean | null | readonly Diagnostic[] | { readonly [key: string]: Diagnostic };A value a diagnostic block may hold.
Directivetypeno test imports ittype Directive = { readonly kind: "skip"; readonly reason: string } | { readonly kind: "todo"; readonly reason: string };Why a test was not counted as it ran.
failedconstconst failed: (description: string, diagnostics?: { readonly [key: string]: Diagnostic; } | undefined) => TapNodeA failing test, with what was found.
fromLinesfunctionfunction fromLines(lines: readonly string[]): readonly TapNode[]Reads the test lines a database gave back (as the SQL that returns TAP lines does) into results.
| Parameter | What it is |
|---|---|
lines | lines such as ok 1 - party exists and not ok 2 - ...; others are kept as comments |
passconstconst pass: (description: string, subtests?: readonly TapNode[] | undefined) => TapNodeA passing test.
skippedconstconst skipped: (description: string, reason: string) => TapNodeA test that was not run, and why.
tallyfunctionfunction 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.
TapNodetypeno test imports ittype 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.
tapTextfunctionfunction tapText(nodes: readonly TapNode[]): stringWrites results as a TAP version 14 document.
| Parameter | What it is |
|---|---|
nodes | the results, in order |
tapText([pass("party exists"), failed("person has 5 columns", { found: 4 })]);