# Rstest > 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. ## Guide - [Introduction](/guide/start/index.md): 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. - [Quick start](/guide/start/quick-start.md): This chapter introduces how to quickly get started with Rstest. - [Features](/guide/start/features.md): Explore Rstest features for build-integrated testing, including Rstack config reuse, browser mode, sharding, and coverage. - [AI](/guide/start/ai.md): This chapter introduces how 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. - [CLI](/guide/basic/cli.md): Rstest comes with a lightweight CLI that includes commands such as rstest watch and rstest run. - [Configure Rstest](/guide/basic/configure-rstest.md): This chapter introduces how to configure Rstest and its underlying Rsbuild and Rspack. - [Filtering tests](/guide/basic/test-filter.md): Rstest provides a variety of flexible ways to filter and select which test files and test cases to run. - [Mocking](/guide/basic/mock.md): Mock functions, object methods, ESM modules, and CommonJS modules in Rstest, and distinguish mock state from module state. - [Snapshot testing](/guide/basic/snapshot.md): Snapshot Testing is a powerful testing method used to capture and compare serialized representations of component output. - [Test projects](/guide/basic/projects.md): Rstest supports running multiple test projects simultaneously within a single Rstest process. These projects can have different test configurations and test environments. - [Reporters](/guide/basic/reporters.md): Reporters in Rstest control how test results are displayed and processed. - [VS Code extension](/guide/basic/vscode-extension.md): The Rstest VS Code extension keeps your project’s tests in sync inside the editor so you can browse, run, and debug them in VS Code. - [Upgrade Rstest](/guide/basic/upgrade-rstest.md): This section explains how to upgrade the project's Rstest dependencies to the latest version. - [Browser mode (experimental)](/guide/browser-testing/index.md): Rstest provides Browser Mode, allowing you to run tests in a real browser instead of simulated environments like jsdom or happy-dom. - [Getting started](/guide/browser-testing/getting-started.md): This guide will help you configure and run Browser Mode tests in your project. - [Framework guides](/guide/browser-testing/framework-guides.md): This guide provides testing configuration examples for various frontend frameworks in Browser Mode. - [User interactions](/guide/browser-testing/user-interactions.md): This guide covers how to simulate user interactions in Browser Mode tests, and helps you choose between stability, maintainability, and control granularity. - [React](/guide/framework/react.md): This guide covers how to test React applications and components with Rstest. - [Vue](/guide/framework/vue.md): This guide covers how to test Vue applications and components with Rstest. - [More frameworks](/guide/framework/more.md): You can register Rsbuild plugins to enable compilation and testing support for more frameworks. - [Debugging](/guide/advanced/debugging.md): Rstest provides a debug mode to troubleshoot problems, you can add the DEBUG=rstest environment variable when testing to enable Rstest's debug mode,and you can also debug by setting breakpoints in VS Code. - [Profiling](/guide/advanced/profiling.md): Rstest provides various tools and methods to analyze the performance of test runs, helping you identify and resolve performance bottlenecks. - [Adapters](/guide/integration/adapters.md): Adapters are a powerful feature that allows you to convert configurations from other tools (such as build tools or CLIs) into a format that Rstest supports. - [Rslib](/guide/integration/rslib.md): This guide covers how to integrate Rstest with Rslib for seamless testing in your Rslib projects. - [Rsbuild](/guide/integration/rsbuild.md): This guide covers how to integrate Rstest with Rsbuild for seamless testing in your Rsbuild projects. - [Rspack](/guide/integration/rspack.md): This guide covers how to integrate Rstest with Rspack for seamless testing in your Rspack projects. - [Migrating from Jest](/guide/migration/jest.md): Migration guide for moving from Jest to Rstest. - [Migrating from Vitest](/guide/migration/vitest.md): Migration guide for moving from Vitest to Rstest. - [Rstest setup — agent execution prompt](/guide/start/agent-install.md): Set up Rstest in a project that doesn't have a test runner configured yet. Pick the target, detect what it needs, install, verify. - [Migrate to Rstest](/guide/start/agent-migrate.md) ## Config - [Config overview](/config/index.md): This page lists all the configurations for Rstest. See "Configure Rstest" for details. - [root](/config/test/root.md): Specify the project root directory. `root` determines the starting point for loading configuration files, searching test files, etc. - [name](/config/test/name.md): The name of the test project. Includes practical guidance, options, and examples for real projects. - [include](/config/test/include.md): A list of glob patterns that match your test files. These patterns will be resolved relative to the root (process.cwd() by default). - [exclude](/config/test/exclude.md): A list of glob patterns that should be excluded from your test files. - [setupFiles](/config/test/setup-files.md): A list of paths to modules that run some code to configure or set up the testing environment, they will be run before each test file. - [globalSetup](/config/test/global-setup.md): The globalSetup option in Rstest allows you to run setup and teardown code that executes once before all tests and after all tests complete. - [projects](/config/test/projects.md): Define multiple test projects. It can be an array of directories, configuration files, or glob patterns, or an object. - [update](/config/test/update.md): When update is enabled, Rstest will update all changed snapshots and delete obsolete ones. - [globals](/config/test/globals.md): Provide global Rstest APIs for test files, such as expect, test, describe, etc. - [passWithNoTests](/config/test/pass-with-no-tests.md): Pass when no tests are found. Includes practical guidance, options, and examples for real projects. - [includeSource](/config/test/include-source.md): In-source testing is where the test code lives within the same file as the source code, similar to Rust's module tests. - [testNamePattern](/config/test/test-name-pattern.md): Run only tests with a name that matches the regex / string. - [extends](/config/test/extends.md): The extends option allows you to extend your Rstest configuration from external sources, such as adapters that convert other build tools' configurations to Rstest-compatible format - [env](/config/test/env.md): Custom environment variables available on process.env during tests. - [bail](/config/test/bail.md): Abort the test run after the specified number of test failures. This is useful for stopping test runs early when failures occur. - [retry](/config/test/retry.md): Retry the test specific number of times if it fails. This is useful for some flaky or non-deterministic test failures. - [testTimeout](/config/test/test-timeout.md): Default timeout of a test in milliseconds. 0 will disable the timeout. - [hookTimeout](/config/test/hook-timeout.md): Default timeout of hook in milliseconds. 0 will disable the timeout. - [maxConcurrency](/config/test/max-concurrency.md): A number limiting the number of test cases that are allowed to run at the same time when using test.concurrent or wrapped in describe.concurrent. - [shard](/config/test/shard.md): Shards test files for parallel execution. count represents the total number of shards, and index represents the index of the current shard (1-based). - [pool](/config/test/pool.md): Options of pool used to run tests in. Includes practical guidance, options, and examples for real projects. - [isolate](/config/test/isolate.md): Run tests in an isolated environment. Includes practical guidance, options, and examples for real projects. - [testEnvironment](/config/test/test-environment.md): The environment that will be used for testing. Includes practical guidance, options, and examples for real projects. - [browser (experimental)](/config/test/browser.md): Browser Mode configuration. When enabled, tests run in a real browser instead of the Node.js environment. - [clearMocks](/config/test/clear-mocks.md): Automatically clear mock calls, instances, contexts and results before every test. - [resetMocks](/config/test/reset-mocks.md): Automatically reset mock state before every test. Includes practical guidance, options, and examples for real projects. - [restoreMocks](/config/test/restore-mocks.md): Automatically reset mock state before every test. Includes practical guidance, options, and examples for real projects. - [unstubEnvs](/config/test/unstub-envs.md): Restores all process.env values that were changed with rstest.stubEnv before every test. - [unstubGlobals](/config/test/unstub-globals.md): Restores all global variables that were changed with rstest.stubGlobal before every test. - [coverage](/config/test/coverage.md): Collect code coverage and generate coverage reports. - [reporters](/config/test/reporters.md): Configure which reporters to use for test result output. - [includeTaskLocation](/config/test/include-task-location.md): Whether to include the location information of tests when collecting test information. - [logHeapUsage](/config/test/log-heap-usage.md): Log heap usage for each test, it can help to find memory leaks in tests. - [hideSkippedTests](/config/test/hide-skipped-tests.md): Hide logs for skipped test cases to reduce noise in the test output, especially when running tests with filters. - [hideSkippedTestFiles](/config/test/hide-skipped-test-files.md): Hide logs for skipped test files to reduce noise in the test output, especially when running tests with filters. - [slowTestThreshold](/config/test/slow-test-threshold.md): The number of milliseconds after which a test or suite is considered slow and reported as such in the results. - [snapshotFormat](/config/test/snapshot-format.md): Customize the snapshot format using options from the pretty-format. - [chaiConfig](/config/test/chai-config.md): Customize the Chai config. Includes practical guidance, options, and examples for real projects. - [resolveSnapshotPath](/config/test/resolve-snapshot-path.md): Custom handler for resolving snapshot paths in tests. - [printConsoleTrace](/config/test/print-console-trace.md): Print console traces when calling any console method, which is helpful for debugging. - [silent](/config/test/silent.md): Silence intercepted console output from tests, or only keep logs for failed tasks. - [onConsoleLog](/config/test/on-console-log.md): Custom handler for console log in tests, which is helpful for filtering out logs from third-party libraries. - [disableConsoleIntercept](/config/test/disable-console-intercept.md): Disable interception of console logs. By default, Rstest intercepts the console log, which will help track log sources. - [plugins](/config/build/plugins.md): plugins is used to register Rsbuild plugins. Includes practical guidance, options, and examples for real projects. - [source](/config/build/source.md): Options for input source code. Includes practical guidance, options, and examples for real projects. - [output](/config/build/output.md): Options for configuring the output of Rstest, such as whether to output in ES module format. - [resolve](/config/build/resolve.md): Options for module resolution. Includes practical guidance, options, and examples for real projects. - [tools](/config/build/tools.md): Options for low-level tools. Includes practical guidance, options, and examples for real projects. - [dev](/config/build/dev.md): Options for local development. Includes practical guidance, options, and examples for real projects. - [performance](/config/build/performance.md): Configure Rsbuild performance options used by Rstest test builds. ## API - [Runtime API Overview](/api/runtime-api/index.md): This page lists all the testing APIs for Rstest. Includes practical guidance, options, and examples for real projects. - [Expect](/api/runtime-api/test-api/expect.md): expect is used to assert values in tests. It provides a rich set of matchers, supports chainable modifiers, soft assertions, polling, and snapshot testing. - [Test](/api/runtime-api/test-api/test.md): test defines a test case. It supports chainable modifiers and fixture extension for flexible and powerful test definitions. - [Describe](/api/runtime-api/test-api/describe.md): describe defines a test suite. It supports chainable modifiers and parameterized methods for flexible and organized test grouping. - [Hooks](/api/runtime-api/test-api/hooks.md): Hooks allow you to run setup and teardown logic before or after your tests or test suites. - [Browser mode](/api/runtime-api/browser-mode/index.md): The Browser Mode API is provided by @rstest/browser, designed to let you use a Playwright-style Locator workflow in browser tests. - [Locator](/api/runtime-api/browser-mode/locator.md): Locator is the core API for element querying and interaction in Browser Mode. - [Assertion](/api/runtime-api/browser-mode/assertion.md): expect.element is the API for Locator assertions in Browser Mode. It accepts a Locator and returns a chainable assertion object. - [Rstest Utility](/api/runtime-api/rstest/index.md): Rstest provides utility functions to help you out through its rstest helper. - [Mock modules](/api/runtime-api/rstest/mock-modules.md): Rstest supports mocking modules, which allows you to replace the implementation of modules in tests. - [Mock functions](/api/runtime-api/rstest/mock-functions.md): Rstest provides some utility functions to help you mock functions powered by tinyspy. - [Mock instance](/api/runtime-api/rstest/mock-instance.md): MockInstance is the type of all mock/spy instances, providing a rich set of APIs for controlling and inspecting mocks. - [Fake timers](/api/runtime-api/rstest/fake-timers.md): The fake timers may be useful when a piece of code sets a long timeout that we don't want to wait for in a test. - [Utilities](/api/runtime-api/rstest/utilities.md): A set of useful utility functions. Includes practical guidance, options, and examples for real projects. - [Environment variables](/api/runtime-api/environment-variables.md): Environment variables that Rstest sets in the test process and worker processes. ## Others - [Reporter](/api/javascript-api/reporter.md): The Reporter API allows you to create custom test result processors and output formatters. This interface is experimental and may change in future versions. - [Rstest core](/api/javascript-api/rstest-core.md): Rstest offers these core methods. Includes practical guidance, options, and examples for real projects.