projects

  • Type: string[]
  • Default: [<rootDir>]

An array of directories, config files, or glob patterns that define multiple test projects.

rstest will run the tests for each project according to the configuration defined in each project, and the test results from all projects will be combined and displayed.

If there is no projects field, rstest will treat current directory as a single project.

import { defineConfig } from '@rstest/core';

export default defineConfig({
  projects: [
    // A monorepo: each package directory is a project
    'packages/*',

    // All apps that provide an rstest config file
    'apps/**/rstest.config.ts',

    // A specific project directory
    '<rootDir>/services/auth',

    // A specific project's config file
    './projects/web/rstest.config.ts',
  ],
});

It should be noted that project configuration does not inherit root configuration. If there is shared configuration between your sub-projects, you can extract the shared configuration and import it in the sub-project:

packages/pkg-a/rstest.config.ts
import { defineConfig } from '@rstest/core';
import sharedConfig from '../shared/rstest.config';

export default defineConfig({
  ...sharedConfig,
});