# truepass

> Every export of truepass, with its signature and doc comment: parseUnifiedDiff, unexplainedSnapshots, weakenedAssertions, MATCHER_RANK, check, createProgram and 1 more, plus 4 types.

Source: https://truepass.interlace.tools/docs/api

<!-- Generated by scripts/api-reference.ts from the built dist/*.d.ts. Do not edit; run `npx tsx scripts/api-reference.ts`. -->

truepass: what makes a test suite report green without the code passing.

```ts
import { parseUnifiedDiff, unexplainedSnapshots, weakenedAssertions, … } from 'truepass';
```

## Functions

### check

```ts
function check(base: string, git: Git): Promise<Finding[]>;
```

| Parameter | Type |
| :-- | :-- |
| `base` | `string` |
| `git` | `Git` |

**Returns** `Promise<Finding[]>`

### createProgram

The program, over a given git: the real one in the bin, a fake one in the tests.

```ts
function createProgram(git: Git): import("burgee").Manifest;
```

| Parameter | Type |
| :-- | :-- |
| `git` | `Git` |

**Returns** `import("burgee").Manifest`

### parseUnifiedDiff

Parse `git diff --unified=0` output into files and hunks.

```ts
function parseUnifiedDiff(diff: string): FileDiff[];
```

| Parameter | Type |
| :-- | :-- |
| `diff` | `string` |

**Returns** `FileDiff[]`

### unexplainedSnapshots

A changed snapshot needs a `Snapshot: <reason>` line in one of the range's
commit messages — updating a snapshot is how a wrong output becomes the
expected one, so the change has to say what it accepts.

```ts
function unexplainedSnapshots(changedPaths: string[], commitMessages: string): Finding[];
```

| Parameter | Type |
| :-- | :-- |
| `changedPaths` | `string[]` |
| `commitMessages` | `string` |

**Returns** `Finding[]`

### weakenedAssertions

Assertions on the same subject that moved to a weaker matcher. An
`Assertion: <why>` line in one of the range's commit messages accepts them.

```ts
function weakenedAssertions(files: FileDiff[], commitMessages: string): Finding[];
```

| Parameter | Type |
| :-- | :-- |
| `files` | `FileDiff[]` |
| `commitMessages` | `string` |

**Returns** `Finding[]`

## Constants

### MATCHER_RANK

Strictness, strongest first. A change that moves an assertion on the same
subject to a lower rank accepts more wrong answers than it did.

```ts
const MATCHER_RANK: Readonly<Record<string, number>>;
```

### program

```ts
const program: import("burgee").Manifest;
```

## Interfaces

### ChangedLine

The two truepass checks a lint rule cannot make, because they are
about what a change did rather than what a file says: an assertion moved to
a weaker matcher, and a snapshot rewritten with no reason given.

```ts
interface ChangedLine {
    line: number;
    text: string;
}
```

### FileDiff

```ts
interface FileDiff {
    path: string;
    hunks: Hunk[];
}
```

### Finding

```ts
interface Finding {
    check: 'weakened-assertion' | 'unexplained-snapshot';
    path: string;
    line: number;
    message: string;
}
```

### Hunk

```ts
interface Hunk {
    removed: ChangedLine[];
    added: ChangedLine[];
}
```
