> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.

# test

The `rs test` command uses [Rstest](https://rstest.rs/guide/basic/cli) to run tests.

For more guidance on testing, see [Testing](/guide/testing.md).

## Usage

```bash
rs test [command] [...filters] [options]
```

The command loads the test configuration registered with [`define.test()`](/guide/configuration.md#define-test).

## Options

`rs test` supports the same test runtime options and filters as Rstest. See the [Rstest CLI documentation](https://rstest.rs/guide/basic/cli#cli-options) and [Filtering tests](https://rstest.rs/guide/basic/test-filter) for details.

Examples:

```bash
# Run a specific test file
rs test tests/foo.test.ts

# Run tests with names containing "login"
rs test -t login

# Collect code coverage
rs test --coverage
```

## Subcommands

### run

[`rs test run`](https://rstest.rs/guide/basic/cli#rstest-run) runs matching tests once without watch mode. It is suitable for CI environments.

```bash
rs test run
```

### watch

[`rs test watch`](https://rstest.rs/guide/basic/cli#rstest-watch) reruns related tests when a test file or its dependencies change.

```bash
rs test watch
```

### list

[`rs test list`](https://rstest.rs/guide/basic/cli#rstest-list) lists matching tests without running them.

```bash
rs test list
```

### merge-reports

[`rs test merge-reports`](https://rstest.rs/guide/basic/cli#rstest-merge-reports) merges blob reports generated by multiple test shards.

```bash
rs test merge-reports
```

### init

[`rs test init`](https://rstest.rs/guide/basic/cli#rstest-init) initializes an Rstest configuration for a supported project type.

```bash
rs test init browser
```

## Configuration

Configure tests through [`define.test()`](/guide/configuration.md#define-test) in the [Rstack configuration file](/guide/configuration.md#configuration-file). It accepts the standard [Rstest configuration](https://rstest.rs/config/):

```ts title="rstack.config.ts"
import { define } from 'rstack';

define.app({
  // Shared application configuration
});

define.test({
  setupFiles: ['./tests/rstest.setup.ts'],
  testEnvironment: 'happy-dom',
});
```
