extends
- Type:
ExtendConfig | ExtendConfigFn - Default:
undefined
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.
This enables:
- Adapter Integration: Extend from adapters like
@rstest/adapter-rslib - Async Configuration: Load configuration from external sources asynchronously
- Config Merging: Automatically merge extended configuration with your local Rstest config
Basic usage (object)
ExtendConfig is a plain subset of RstestConfig without projects.
You can use it to extend your Rstest configuration from external sources. Rstest will merge the extended config with your local config following the configuration merging rules.
Function usage
ExtendConfigFn is a function that takes the user's Rstest config as input and returns an extended config.
You can use this to load external configuration files, fetch remote configs, or conditionally modify the config based on user settings.
Configuration merging
Rstest deep-merges object fields and overrides primitives. Local config always takes precedence over the extended config.
Example:
Using adapters
Example: extend from Rslib config
Use the @rstest/adapter-rslib adapter to extend Rstest configuration from an existing Rslib config file. The adapter automatically maps compatible options like source.define, source.include, source.exclude, and more.
Limitations
The extends configuration cannot include the projects field. To define multiple projects, extend each project individually: