--- url: /guide/start/index.md --- # Introduction Rstest is a testing framework powered by Rspack. It delivers comprehensive, first-class support for the Rspack ecosystem, enabling seamless integration into existing Rspack-based projects. Rstest offers full Jest-compatible APIs while providing native, out-of-the-box support for TypeScript, ESM, CJS, and more, ensuring a modern and efficient testing experience. ## ✨ Why Rstest Rstest is built on top of Rspack and Rsbuild, and works out of the box with built-in support for common use cases such as TypeScript, ESM, CJS, and CSS Modules. Even if you are not using Rspack, Rstest can be adopted without migrating your existing build system. For projects already using the Rstack toolchain (Rspack, Rsbuild, Rslib, etc.), Rstest can further **reuse your existing build configuration**—including module resolution, code transformation, and plugin capabilities—eliminating the need to maintain separate transform or resolver setups for testing. In terms of execution model, Rstest runs tests using a dependency graph–based **bundle model**, rather than the traditional per-file transform-and-execute approach. This enables it to fully leverage build-time optimizations—such as tree-shaking and skipping unused re-exports in side-effect-free barrel files—bringing test behavior closer to real production output. As a result, Rstest reduces redundant module transformations and executions in large-scale projects, improving both performance and stability. By integrating testing into the build pipeline, Rstest simplifies the overall toolchain, reduces the duplicated cost of maintaining separate configuration and plugin systems, and allows testing to fit more naturally into modern engineering architectures such as monorepos and complex applications. In the future, Rstest will continue evolving around a unified “build + test” model—exploring more efficient approaches to quality assurance, and integrating more deeply with CI systems and AI-driven workflows. ## 🔥 Roadmap Rstest now supports core testing scenarios including Node / DOM testing, mocking, multi-project testing, and coverage collection, and has been successfully implemented in Rstack projects (including Rsbuild, Rslib, Rspack, and others). The project is currently in active development, and we will continue to refine functionality and enhance the user experience based on community feedback. For future development plans, please refer to the [Rstest Roadmap](https://github.com/web-infra-dev/rstest/issues/85). ## 🦀 Rstack Rstack is a unified JavaScript toolchain centered on Rspack, with high performance and consistent architecture. ![Rstack](https://assets.rspack.rs/rstack/rstack-overview.png) Rstack includes the following tools: | Name | Description | Version | | ----------------------------------------------------- | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | [Rspack](https://github.com/web-infra-dev/rspack) | Bundler | npm version | | [Rsbuild](https://github.com/web-infra-dev/rsbuild) | Build tool | npm version | | [Rslib](https://github.com/web-infra-dev/rslib) | Library development tool | npm version | | [Rspress](https://github.com/web-infra-dev/rspress) | Static site generator | npm version | | [Rsdoctor](https://github.com/web-infra-dev/rsdoctor) | Build analyzer | npm version | | [Rstest](https://github.com/web-infra-dev/rstest) | Testing framework | npm version | | [Rslint](https://github.com/web-infra-dev/rslint) | Linter | npm version | ## 🔗 Links - [awesome-rstack](https://github.com/rstackjs/awesome-rstack): A curated list of awesome things related to Rstack. - [rstack-examples](https://github.com/rstackjs/rstack-examples): Examples showcasing Rstack tools. - [storybook-rsbuild](https://github.com/rstackjs/storybook-rsbuild): Storybook builder powered by Rsbuild. - [rsbuild-plugin-template](https://github.com/rstackjs/rsbuild-plugin-template): Use this template to create your own Rsbuild plugin. - [rstack-design-resources](https://github.com/rstackjs/rstack-design-resources): Design resources for Rstack. ## 🧑‍💻 Community Come and chat with us on [Discord](https://discord.gg/XsaKEEk4mW)! The Rstack team and users are active there, and we're always looking for contributions. --- url: /guide/start/quick-start.md --- # Quick start NOTE FOR AI CODING AGENTS: Do not follow this page. Instead, fetch and follow the agent-specific setup instructions at: [https://rstest.rs/guide/start/agent-install.md](https://rstest.rs/guide/start/agent-install.md) ## Online examples You can try Rstest online without any setup by using the following examples: - [StackBlitz Example](https://stackblitz.com/~/github.com/rstackjs/rstest-stackblitz-example) ## Setup environment Before getting started, you will need to install [Node.js](https://nodejs.org/) >= 20.19.0, it is recommended to use the Node.js LTS version. Check the current Node.js version with the following command: ```bash node -v ``` If you do not have Node.js installed in current environment, or the installed version is too low, you can use [nvm](https://github.com/nvm-sh/nvm) or [fnm](https://github.com/Schniz/fnm) to install. Here is an example of how to install via nvm: ```bash # Install Node.js LTS nvm install --lts # Switch to Node.js LTS nvm use --lts ``` ## Using Rstest ### Agent prompt If you are using a coding agent, you can copy the following prompt to set up Rstest automatically: For your AgentSet up RstestCopy this prompt and send it to your coding agent. Copy PromptSet up Rstest in this project by following the instructions here: https://rstest.rs/guide/start/agent-install.md If you are migrating from an existing Jest or Vitest project, use this prompt: For your AgentMigrate to RstestCopy this prompt and send it to your coding agent. Copy PromptMigrate this project to Rstest by following the instructions here: https://rstest.rs/guide/start/agent-migrate.md ### Manual installation You can install Rstest using the following command: ```sh [npm] npm add @rstest/core -D ``` ```sh [yarn] yarn add @rstest/core -D ``` ```sh [pnpm] pnpm add @rstest/core -D ``` ```sh [bun] bun add @rstest/core -D ``` ```sh [deno] deno add npm:@rstest/core -D ``` Next, you need to update the npm scripts in your package.json to use Rstest's CLI commands. ```json title=package.json { "scripts": { "test": "rstest" } } ``` After completing the above steps, you can run the Rstest tests using `npm run test`, `yarn test`, or `pnpm test`. Alternatively, you can directly use `npx rstest` to execute the Rstest tests. Rstest has built-in commands such as `watch` and `run`, please refer to [CLI Tools](/guide/basic/cli.md) to learn about all available commands and options. ## Writing tests As a simple example, we have a `sayHi` method. To test it, you can create a test file called `index.test.ts` or use [In-Source test](/config/test/include-source.md) similar to [Rust Test](https://doc.rust-lang.org/book/ch11-03-test-organization.html#the-tests-module-and-cfgtest). ```ts title=index.ts export const sayHi = () => 'hi'; ``` ```ts title=index.test.ts import { expect, test } from '@rstest/core'; import { sayHi } from '../src/index'; test('should sayHi correctly', () => { expect(sayHi()).toBe('hi'); }); ``` Next, you can execute the test by using the command configured in [Using Rstest](#using-rstest). Rstest will print the following message: ```bash ✓ test/index.test.ts (1) Test Files 1 passed Tests 1 passed Duration 140 ms (build 17 ms, tests 123 ms) ``` --- url: /guide/start/features.md --- # Features Rstest brings testing into the Rsbuild and Rspack build pipeline. It reuses build configuration where possible, runs tests through a bundle-based execution model, and provides the core testing features needed for local development and CI. ## Reuse existing build setup Rstest can reuse Rsbuild and Rspack configuration, including module resolution, transforms, and plugin behavior. This reduces the need for a separate test-only build setup and keeps tests aligned with the code that ships. Learn more about [Configuring Rstest](/guide/basic/configure-rstest.md). ### Built on Rspack Rstest runs tests on top of Rspack's bundling pipeline, so it can benefit from build-time optimizations such as Tree Shaking and [lazyBarrel](https://rspack.rs/guide/optimization/lazy-barrel) while keeping test behavior closer to real output. ### Transpiled with SWC By default, Rstest uses Rspack's built-in SWC loader to transform JavaScript and TypeScript. You can customize SWC options in the configuration file when a project needs different syntax or transform behavior. Learn more about [Configuring SWC](/guide/basic/configure-rstest.md#configure-swc). ## Multi-project testing Rstest can run multiple test projects in one process, with each project keeping its own configuration and environment. This is useful for monorepos, multi-app workspaces, and projects that need separate Node, DOM, or Browser Mode test targets. Learn more about [Test projects](/guide/basic/projects.md). ## Test sharding Rstest can split test files into shards for parallel execution. In CI, you can distribute the same test suite across multiple machines to reduce total runtime, then use the `blob` reporter and `rstest merge-reports` to merge test results and coverage data after all shards complete. Learn more about [Test sharding](/config/test/shard.md). ## In-source tests Rstest supports a Rust-like module testing style that lets you write test blocks directly inside source files. It works well for small utilities and helpers where keeping fast checks next to the implementation makes development easier. Learn more about [In-source tests](/config/test/include-source.md). ## Watch mode When you modify a test file or one of its dependencies, Rstest analyzes the module graph and only reruns the affected test files. This keeps local feedback fast as the test suite grows. ## DOM testing Rstest can simulate the DOM and browser APIs with jsdom or happy-dom. It supports common framework testing workflows for React and Vue, and works with Testing Library and CSS Modules. Learn more about [DOM testing](/config/test/test-environment.md#dom-testing). ## Browser mode Rstest provides Browser Mode for tests that need a real browser instead of a simulated environment such as jsdom or happy-dom. This helps validate browser APIs, rendering behavior, and interactions that are difficult to cover in DOM simulators. Browser Mode is powered by [Playwright](https://playwright.dev/) and can run tests in Chromium, Firefox, and WebKit, making it suitable for cross-browser verification. Learn more about [Browser mode](/guide/browser-testing.md). ## Code coverage Rstest can collect code coverage with [istanbul](https://istanbul.js.org/). Enable it by setting `coverage.enabled` to `true` in your Rstest configuration file. Learn more about [Code coverage](/config/test/coverage.md). ## More capabilities - Jest-compatible assertions and snapshots - Mock and spy utilities - File-level sandbox isolation - Lifecycle hooks for setup and teardown - Built-in reporters and CI output - Filtering by directory, project, file, or test name - VS Code extension --- url: /guide/start/ai.md --- # AI To help AI better understand Rstest's features, configuration, and best practices so it can provide more accurate assistance during day-to-day development and troubleshooting, Rstest provides the following capabilities: - [Agent prompt](#agent-prompt) - [Agent Skills](#agent-skills) - [llms.txt](#llmstxt) - [Markdown docs](#markdown-docs) - [Markdown reporter](#markdown-reporter) - [AGENTS.md](#agentsmd) ## Agent prompt If you are using a coding agent (such as Claude Code, Cursor, Copilot, etc.), copy the prompt that matches your project. The agent will read the linked instructions and install dependencies, create configuration, and write tests based on your project type. ### Set up Rstest Use this prompt to add Rstest to a project that doesn't have a test runner configured yet: For your AgentSet up RstestCopy this prompt and send it to your coding agent. Copy PromptSet up Rstest in this project by following the instructions here: https://rstest.rs/guide/start/agent-install.md ### Migrate from Jest or Vitest Use this prompt to migrate an existing Jest or Vitest project to Rstest. For convenience, the linked instructions inline the full [migrate-to-rstest](https://github.com/rstackjs/agent-skills#migrate-to-rstest) skill so nothing needs to be installed; alternatively, you can [install the skill](#agent-skills) and use it directly: For your AgentMigrate to RstestCopy this prompt and send it to your coding agent. Copy PromptMigrate this project to Rstest by following the instructions here: https://rstest.rs/guide/start/agent-migrate.md ## Agent Skills Agent Skills are domain-specific knowledge packs that can be installed into Agents, enabling them to give more accurate and professional suggestions or perform actions in specific scenarios. In the [rstackjs/agent-skills](https://github.com/rstackjs/agent-skills) repository, there are many skills for the Rstack ecosystem. The skills related to Rstest include: - [migrate-to-rstest](https://github.com/rstackjs/agent-skills#migrate-to-rstest): Migrate Jest or Vitest projects to Rstest. - [rstest-best-practices](https://github.com/rstackjs/agent-skills#rstest-best-practices): Share best practices for using Rstest. In Coding Agents that support skills, you can use the [skills](https://www.npmjs.com/package/skills) package to install a specific skill with the following command: ```sh [npx] npx skills add rstackjs/agent-skills --skill migrate-to-rstest ``` ```sh [yarn] yarn dlx skills add rstackjs/agent-skills --skill migrate-to-rstest ``` ```sh [pnpm] pnpm dlx skills add rstackjs/agent-skills --skill migrate-to-rstest ``` ```sh [bunx] bunx skills add rstackjs/agent-skills --skill migrate-to-rstest ``` ```sh [deno] deno run -A npm:skills add rstackjs/agent-skills --skill migrate-to-rstest ``` After installation, simply use natural language prompts to trigger the skill, for example: ``` Help me migrate this Jest project to Rstest ``` ## llms.txt [llms.txt](https://llmstxt.org/) is a standard that helps LLMs discover and use project documentation. Rstest follows this standard and publishes the following two files: - [llms.txt](https://rstest.rs/llms.txt): A structured index file containing the titles, links, and brief descriptions of all documentation pages. ``` https://rstest.rs/llms.txt ``` - [llms-full.txt](https://rstest.rs/llms-full.txt): A full-content file that concatenates the complete content of every documentation page into a single file. ``` https://rstest.rs/llms-full.txt ``` You can choose the file that best fits your use case: - `llms.txt` is smaller and consumes fewer tokens, making it suitable for AI to fetch specific pages on demand. - `llms-full.txt` contains the complete documentation content, so AI doesn't need to follow individual links — ideal when you need AI to have a comprehensive understanding of Rstest, though it consumes more tokens and is best used with AI tools that support large context windows. ## Markdown docs Every Rstest documentation page has a corresponding `.md` plain-text version that can be provided directly to AI. On any doc page, you can click “Copy Markdown” or “Copy Markdown Link” under the title to get the Markdown content or link. ``` https://rstest.rs/guide/start/index.md ``` Providing the Markdown link or content allows AI to focus on a specific chapter, which is useful for targeted troubleshooting or looking up a particular topic. ## Markdown reporter When you want AI to directly consume test results, use the `md` reporter. It outputs a single markdown document to stdout, which is easier for LLMs to parse than colorful terminal logs. The output is also more concise, which usually reduces token usage. In Agent environments, Rstest defaults to `md` when you didn't explicitly configure reporters. ```bash npx rstest --reporter=md ``` You can also configure it in `rstest.config.ts` and combine it with other reporters in local or CI workflows. ```ts import { defineConfig } from '@rstest/core'; export default defineConfig({ reporters: ['md'], }); ``` More information about the `md` reporter can be found in [Markdown reporter](/guide/basic/reporters.md#markdown-reporter). ## AGENTS.md You can create an `AGENTS.md` file in the root of any project that uses Rstest. This file follows the [AGENTS.md](https://agents.md/) specification and provides key project information to Agents. Here is an example of Rstest-related content you can add to `AGENTS.md`: ```markdown wrapCode # AGENTS.md You are an expert in JavaScript, Rspack, Rsbuild, and Rstest. You write maintainable, performant, and accessible tests. ## Tools ### Rstest - Run `npm run test` to run tests (`npx rstest`) - Run `npm run test:watch` to run tests in watch mode (`npx rstest --watch`) ## Docs - Rstest: https://rstest.rs/llms.txt ``` You can also customize it for your project, adding more details about the project structure, overall architecture, and other relevant information so Agents can better understand your project. ::: tip If you are using Claude Code, you can create a `CLAUDE.md` file and reference the `AGENTS.md` file in it. ```markdown title="CLAUDE.md" @AGENTS.md ``` ::: --- url: /guide/basic/cli.md --- # CLI Rstest comes with a lightweight CLI that includes commands such as [rstest watch](#rstest-watch) and [rstest run](#rstest-run). ## rstest -h `rstest -h` can help you view all available CLI commands and options: ```bash npx rstest -h ``` The output is shown below: ```bash Usage: $ rstest [...filters] Commands: [...filters] run tests run [...filters] run tests without watch mode watch [...filters] run tests in watch mode list [...filters] lists all test files that Rstest will run merge-reports [path] Merge blob reports from multiple shards into a unified report init [project] Initialize rstest configuration Options: -h, --help Display this message -v, --version Display version number ``` Use `npx rstest -h` to see command-specific options. For example, `npx rstest init -h` only shows initialization options, while `npx rstest merge-reports -h` only shows merge-related options. ## rstest \[...filters] Running `rstest` directly will enable the Rstest test in the current directory. ```bash $ npx rstest ✓ test/index.test.ts (2 tests) 1ms Test Files 1 passed (1) Tests 2 passed (2) Duration 189 ms (build 22 ms, tests 167 ms) ``` ### Watch mode If you want to automatically rerun the test when the file changes, you can use the `--watch` flag or `rstest watch` command: ```bash $ npx rstest --watch ``` ## rstest run `rstest run` will perform a single run, and the command is suitable for CI environments or scenarios where tests are not required to be performed while modifying. ### Run related tests [Added in v0.10.0](https://github.com/web-infra-dev/rstest/releases/tag/v0.10.0) Use `--related` when you want Rstest to treat positional arguments as source files and only run the tests that depend on those files. ```bash npx rstest run --related src/button.ts ``` Rstest resolves related tests from the build module graph, so the same filter works for Node mode and Browser Mode projects. You can also use the Jest-compatible alias: ```bash npx rstest run --findRelatedTests src/button.ts ``` If you only want to inspect the affected test files, combine it with `rstest list`: ```bash npx rstest list --related src/button.ts --filesOnly ``` ## rstest watch `rstest watch` will start listening mode and execute tests, and when the test or dependent file modifications, the associated test file will be re-execute. ## rstest list `rstest list` will print a test list of all matching conditions. By default, it prints the test names of all matching tests. ```bash $ npx rstest list # the output is shown below: a.test.ts > test a > test a-1 a.test.ts > test a-2 b.test.ts > test b > test b-1 b.test.ts > test b-2 ``` The `rstest list` command inherits all `rstest` filtering options, you can filter files directly or use `-t` to filter the specified test name. ```bash $ npx rstest list -t='test a' # the output is shown below: a.test.ts > test a > test a-1 a.test.ts > test a-2 ``` You can use `--filesOnly` to make it print the test files only: ```bash $ npx rstest list --filesOnly # the output is shown below: a.test.ts b.test.ts ``` You can use `--json` to make it print tests in JSON format in terminal or save the results to a separate file: ```bash $ npx rstest list --json $ npx rstest list --json=./output.json ``` You can use `--includeSuites` to print test suites along side test cases: ```bash $ npx rstest list # the output is shown below: a.test.ts > test a a.test.ts > test a > test a-1 a.test.ts > test a-2 b.test.ts > test b b.test.ts > test b > test b-1 b.test.ts > test b-2 ``` You can use `--printLocation` to print location of tests: ```bash $ npx rstest list # the output is shown below: a.test.ts:4:5 > test a > test a-1 a.test.ts:9:3 > test a-2 b.test.ts:4:5 > test b > test b-1 b.test.ts:9:3 > test b-2 ``` You can use `--summary` to append a compact summary after the list output: ```bash $ npx rstest list --summary # the output is shown below: a.test.ts > test a > test a-1 a.test.ts > test a-2 b.test.ts > test b > test b-1 b.test.ts > test b-2 c.test.ts > test c it each 0 c.test.ts > test c it for 0 c.test.ts > test c it runIf c.test.ts > test c it skipIf Test Files 3 matched Tests 8 matched ``` When used with `--json`, `--summary` changes the JSON output shape from an array to an object with `items` and `summary` fields. ## rstest merge-reports [Added in v0.9.3](https://github.com/web-infra-dev/rstest/releases/tag/v0.9.3) `rstest merge-reports` merges blob reports generated by multiple test shards into a single unified report. This is useful when running tests in parallel across multiple CI machines using `--shard`. ### Workflow 1. Run each shard with the `blob` reporter to generate blob report files: ```bash # On CI machine 1 npx rstest run --shard 1/3 --reporter=blob # On CI machine 2 npx rstest run --shard 2/3 --reporter=blob # On CI machine 3 npx rstest run --shard 3/3 --reporter=blob ``` 2. Collect all `.rstest-reports/` directories into a single location, then merge: ```bash npx rstest merge-reports ``` By default, blob reports are read from `.rstest-reports/` in the project root. You can specify a custom path: ```bash npx rstest merge-reports ./custom-reports-dir ``` The merge command will: - Combine test results from all shards - Run configured reporters (e.g., `default`, `junit`) with the merged data - Merge and generate coverage reports (if coverage is enabled) Use `--cleanup` to remove the blob reports directory after merging: ```bash npx rstest merge-reports --cleanup ``` ## rstest init `rstest init` creates starter configuration for supported project types. ```bash npx rstest init ``` Currently, `browser` is the available initializer: ```bash npx rstest init browser ``` Use `--yes` to skip the interactive prompt and apply the default setup: ```bash npx rstest init browser --yes ``` ## CLI options Rstest CLI options are registered per command instead of being shared by every command. ### Test commands `rstest`, `rstest run`, and `rstest watch` share the same test runtime options: | Flag | Description | | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `-c, --config ` | Specify the configuration file, can be a relative or absolute path, see [Specify config file](/guide/basic/configure-rstest.md#specify-config-file) | | `--config-loader ` | Specify the config loader (`auto` \| `jiti` \| `native`), see [Rsbuild - Specify config loader](https://rsbuild.rs/guide/configuration/rsbuild#specify-config-loader) | | `-r, --root ` | Specify the project root directory, see [root](/config/test/root.md) | | `--related` | Treat positional arguments as source file paths and only run related tests | | `--findRelatedTests` | Alias for `--related` for Jest compatibility | | `--globals` | Provide global APIs, see [globals](/config/test/globals.md) | | `--isolate` | Run tests in an isolated environment, see [isolate](/config/test/isolate.md) | | `--reporter ` | Specify the test reporter, see [reporters](/config/test/reporters.md) | | `--exclude ` | Exclude files from test, see [exclude](/config/test/exclude.md) | | `-u, --update` | Update snapshot files, see [update](/config/test/update.md) | | `--coverage` | Enable code coverage collection, see [coverage](/config/test/coverage.md) | | `--passWithNoTests` | Allows the test suite to pass when no files are found, see [passWithNoTests](/config/test/pass-with-no-tests.md) | | `--silent [value]` | Silence intercepted test console output, or keep logs only for failed tasks with `passed-only`, see [silent](/config/test/silent.md) | | `--printConsoleTrace` | Print console traces when calling any console method, see [printConsoleTrace](/config/test/print-console-trace.md) | | `--project ` | Only run tests for the specified project, see [Filter by project name](/guide/basic/test-filter.md#filter-by-project-name) | | `--disableConsoleIntercept` | Disable console intercept, see [disableConsoleIntercept](/config/test/disable-console-intercept.md) | | `--slowTestThreshold ` | The number of milliseconds after which a test or suite is considered slow, see [slowTestThreshold](/config/test/slow-test-threshold.md) | | `-t, --testNamePattern ` | Run only tests with a name that matches the regex, see [testNamePattern](/config/test/test-name-pattern.md) | | `--testEnvironment ` | The environment that will be used for testing, see [testEnvironment](/config/test/test-environment.md) | | `--testTimeout ` | Timeout of a test in milliseconds, see [testTimeout](/config/test/test-timeout.md) | | `--hookTimeout ` | Timeout of hook in milliseconds, see [hookTimeout](/config/test/hook-timeout.md) | | `--retry ` | Number of times to retry a test if it fails, see [retry](/config/test/retry.md) | | `--bail [number]` | Abort the test run after the specified number of test failures, see [bail](/config/test/bail.md) | | `--browser, --browser.enabled` | Run tests in Browser Mode, see [browser](/config/test/browser.md) | | `--browser.name ` | Browser to use: `chromium`, `firefox`, `webkit` (default: `chromium`), see [browser](/config/test/browser.md) | | `--browser.headless` | Run browser in headless mode (default: `true` in CI), see [browser](/config/test/browser.md) | | `--browser.port ` | Port for the Browser Mode dev server, see [browser](/config/test/browser.md) | | `--browser.strictPort` | Exit if the specified port is already in use, see [browser](/config/test/browser.md) | | `--maxConcurrency ` | Maximum number of concurrent tests, see [maxConcurrency](/config/test/max-concurrency.md) | | `--clearMocks` | Automatically clear mock calls, instances, contexts and results before every test, see [clearMocks](/config/test/clear-mocks.md) | | `--resetMocks` | Automatically reset mock state before every test, see [resetMocks](/config/test/reset-mocks.md) | | `--restoreMocks` | Automatically restore mock state and implementation before every test, see [restoreMocks](/config/test/restore-mocks.md) | | `--unstubGlobals` | Restores all global variables that were changed with `rstest.stubGlobal` before every test, see [unstubGlobals](/config/test/unstub-globals.md) | | `--unstubEnvs` | Restores all `process.env` values that were changed with `rstest.stubEnv` before every test, see [unstubEnvs](/config/test/unstub-envs.md) | | `--include ` | Specify test file matching pattern, see [include](/config/test/include.md) | | `--logHeapUsage` | Print heap usage for each test, see [logHeapUsage](/config/test/log-heap-usage.md) | | `--hideSkippedTests` | Do not display skipped test logs, see [hideSkippedTests](/config/test/hide-skipped-tests.md) | | `--hideSkippedTestFiles` | Do not display skipped test file logs, see [hideSkippedTestFiles](/config/test/hide-skipped-test-files.md) | | `--pool ` | Shorthand for `--pool.type`, see [pool](/config/test/pool.md) | | `--pool.type ` | Specify the test pool type, see [pool](/config/test/pool.md) | | `--pool.maxWorkers ` | Maximum number or percentage of workers, see [pool](/config/test/pool.md) | | `--pool.minWorkers ` | Minimum number or percentage of workers, see [pool](/config/test/pool.md) | | `--pool.execArgv ` | Additional Node.js execArgv for worker processes (repeatable), see [pool](/config/test/pool.md) | | `-h, --help` | Display help for command | `rstest` also supports `-w, --watch`, which switches the default command into watch mode. ### rstest list `rstest list` supports the same filtering and config options as the test commands above, and adds: | Flag | Description | | ----------------------- | ------------------------------------------- | | `--filesOnly` | Only print matching test files | | `--json [boolean/path]` | Print tests as JSON or write JSON to a file | | `--includeSuites` | Include suites in the output | | `--printLocation` | Print test and suite locations | | `--summary` | Print a compact summary after the list | ### rstest merge-reports `rstest merge-reports` has its own smaller option set: | Flag | Description | | -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `-c, --config ` | Specify the configuration file, can be a relative or absolute path, see [Specify config file](/guide/basic/configure-rstest.md#specify-config-file) | | `--config-loader ` | Specify the config loader (`auto` \| `jiti` \| `native`), see [Rsbuild - Specify config loader](https://rsbuild.rs/guide/configuration/rsbuild#specify-config-loader) | | `-r, --root ` | Specify the project root directory, see [root](/config/test/root.md) | | `--coverage` | Enable coverage generation after merging, see [coverage](/config/test/coverage.md) | | `--reporter ` | Specify which reporters run on merged results, see [reporters](/config/test/reporters.md) | | `--cleanup` | Remove the blob reports directory after merging | | `-h, --help` | Display help for command | ### rstest init `rstest init` only accepts initialization-specific options: | Flag | Description | | ------------ | ------------------------------------------- | | `--yes` | Use default options and skip interactive UI | | `-h, --help` | Display help for command | ### Boolean option negation For boolean options, you can use the `--no-