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

# testing: Starting a chain

> Starting a chain: the declaration and description of each of the 6 exports of @eco-incorp/sauce/testing.

`@eco-incorp/sauce/testing` runs programs on a local chain inside a test, in Node only. `fork(chain, options)` starts a copy of a real chain (an EVM chain at `options.block`) with the Sauce release, replaying a recorded state file, recording one, or reading the live chain; `local(options?)` starts an empty chain (Base unless `options.chain` names another, Solana included) with the Sauce release deployed and no Kitchen fee. An EVM chain runs on Foundry's `anvil`, which must be on `PATH`; Solana runs in LiteSVM.

```typescript theme={null}
import { fork, local, CookReverted } from "@eco-incorp/sauce/testing";
```

Generated from the type declarations of `@eco-incorp/sauce`.

### `fork`

*Function* · `@eco-incorp/sauce/testing`

Forks Solana in LiteSVM, ready to cook: the released engine and Kitchen, ten test accounts each
holding 1,000 SOL, account 0's Pot created. Every account a test names is read when it is first
named: from the cluster (recording it), or from a recorded state file. Stop it with `stop()`; a
recording is written then.
Forks `chain` at `options.block` on a local anvil, ready to cook: the released stack (the chain's
own, or deployed), and anvil's dev accounts as test accounts, account 0's Pot deployed. Replays a
recorded state file, records one, or forks live (see `ForkOptions.mode`). Stop it with
`stop()`; a recording is written then.

```typescript theme={null}
export declare function fork(chain: SolanaChainRef, options: SolanaForkOptions): Promise<SolanaTestChain>;
export declare function fork(chain: ChainRef, options: ForkOptions): Promise<TestChain>;
```

### `local`

*Function* · `@eco-incorp/sauce/testing`

An empty Solana chain in LiteSVM - no programs but the runtime's own, no tokens but wrapped SOL - with the released engine and Kitchen at their program ids and no Kitchen fee. For programs that
need nothing deployed; fork Solana for anything that calls a program or moves a token.
An empty local chain - no protocols, no tokens - with the released stack deployed at its release
addresses and no Kitchen fee, running as `options.chain` (Base by default). For programs that
need nothing deployed; fork a chain for anything that calls a protocol.

```typescript theme={null}
export declare function local(options: {
    readonly chain: SolanaChainRef;
}): Promise<SolanaTestChain>;
export declare function local(options?: LocalOptions): Promise<TestChain>;
```

### `SolanaChainRef`

*Type* · `@eco-incorp/sauce/testing`

Solana, by any name the registry knows it by.

```typescript theme={null}
export type SolanaChainRef = "solana" | "sol" | "mainnet-beta" | "solana-mainnet" | 1399811149;
```

### `ForkOptions`

*Interface* · `@eco-incorp/sauce/testing`

```typescript theme={null}
export interface ForkOptions {
    readonly block: number | bigint;
    readonly state?: string;
    readonly rpcUrl?: string;
    readonly mode?: "auto" | ForkMode;
    readonly blockInterval?: number;
    readonly zeroFee?: boolean;
    readonly anvil?: string;
}
```

### `LocalOptions`

*Interface* · `@eco-incorp/sauce/testing`

```typescript theme={null}
export interface LocalOptions {
    readonly chain?: ChainRef;
    readonly anvil?: string;
}
```

### `ForkMode`

*Type* · `@eco-incorp/sauce/testing`

```typescript theme={null}
export type ForkMode = "replay" | "record" | "live";
```


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