> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nika.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Test and trace

> Keep CLI goldens separate from typed receipt verification.

> [!TIP]
>
> **One client, local by default.** Import `Nika` from
> the package root and omit `url`. The client takes the engine
> from `bin`, then `NIKA_BIN` (both absolute paths), then
> the platform package npm installed with it; it never uses a
> `nika` found on your `PATH`. These examples target
> the published [0.124.1 SDK release](https://github.com/supernovae-st/nika-client/tree/v0.124.1).

Golden testing is an engine CLI operation:

```sh theme={"system"}
./node_modules/.bin/nika test workflows/release.nika --update   # pin the golden once
./node_modules/.bin/nika test workflows/release.nika            # compare later runs against it
```

`nika test` runs the workflow on the mock provider and compares its typed
`outputs:` with `<file>.golden.json`. `--case <name> --var key=value` pins one
golden per case of a rule table ([Testing](https://docs.nika.sh/guides/testing.md)).

The SDK does not duplicate that command as a client method: run it from
`./node_modules/.bin/nika` in CI. Receipt verification is part of the SDK
because it belongs to the run lifecycle.

```ts theme={"system"}
const run = await nika.run('workflows/release.nika')
const result = await run.result()

if (!result.receipt) throw new Error('run did not issue a receipt')

const verdict = await nika.traceVerify(result.receipt)
if (!verdict.verified) {
  throw new Error(verdict.output ?? verdict.reason ?? 'trace verification failed')
}
```

`traceVerify(receipt)` accepts an engine-issued `NikaReceipt` object only. It does not
accept a path and does not reconstruct or verify the chain in TypeScript.
The engine reads the existing journal and its evidence. Verification does
not seal a trace, and an admitted job does not guarantee a journal exists.

> [card] [Receipts](https://docs.nika.sh/sdk/runtime/receipts.md)
>
> Store proof beside application state.

> [card] [Testing guide](https://docs.nika.sh/guides/testing.md)
>
> Learn goldens and mock-provider workflows.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.