[API reference](https://evolu.dev/docs/api-reference) › [@evolu/common](https://evolu.dev/docs/api-reference/common) › [Test](https://evolu.dev/docs/api-reference/common/Test) › testCreateRun

## Call Signature

```ts
function testCreateRun(): Run<TestDeps>;
```

Defined in: [packages/common/src/Test.ts:141](https://github.com/evoluhq/evolu/blob/e7144e2bbe9069362b62dec1b64a8aa922b8f1b0/packages/common/src/Test.ts#L141)

Creates a test [Run](https://evolu.dev/docs/api-reference/common/Task/interfaces/Run) with deterministic default deps or optional custom
deps.

Use this as the default composition root in tests. Each call creates fresh
[TestDeps](https://evolu.dev/docs/api-reference/common/Test/type-aliases/TestDeps) via [testCreateDeps](https://evolu.dev/docs/api-reference/common/Test/functions/testCreateDeps), then merges any provided custom
deps.

### Example

```ts
// Built-in TestTime
await using run = testCreateRun();
const fiber = run(sleep("1s"));
run.deps.time.advance("1s");
await fiber;

// For a single test, create the dependency using the Run.
await using run = testCreateRun();
await using foo = await run.orThrow(createFoo());
const runWithFoo = run.addDeps({ foo });

expect(runWithFoo.deps.foo).toBe(foo);

// If multiple tests need the same setup, create a disposable helper.
// Then `await using setup` disposes everything the helper owns.
const setupFoo = async () => {
  await using stack = new AsyncDisposableStack();
  const run = stack.use(testCreateRun());
  const foo = stack.use(await run.orThrow(createFoo()));
  const moved = stack.move();

  // Return whatever the tests need: a Run with the dependency,
  // the dependency itself, or both.
  return {
    run: run.addDeps({ foo }),
    foo,
    [Symbol.asyncDispose]: () => moved.disposeAsync(),
  };
};

await using setup = await setupFoo();
const { run, foo } = setup;
expect(run.deps.foo).toBe(foo);
```

Name reusable setup helpers after what they set up:

- `setupFoo` for reusable test setup for `Foo`
- `testSetupFoo` when a library module exports the helper as part of its public
  test API, e.g. `testSetupSqlite`.

## Call Signature

```ts
function testCreateRun<D>(
  deps: D,
): Run<
  Omit<RunDeps, "time" | "console"> &
    TestConsoleDep &
    TestTimeDep &
    RandomLibDep &
    D
>;
```

Defined in: [packages/common/src/Test.ts:144](https://github.com/evoluhq/evolu/blob/e7144e2bbe9069362b62dec1b64a8aa922b8f1b0/packages/common/src/Test.ts#L144)

With custom dependencies merged into [TestDeps](https://evolu.dev/docs/api-reference/common/Test/type-aliases/TestDeps).