For AI agents: the complete documentation index is available at https://rstest.rs/llms.txt, the full documentation bundle is available at https://rstest.rs/llms-full.txt, and this page is available as Markdown at https://rstest.rs/config/test/force-rerun-triggers.md.
close
  • English
  • forceRerunTriggers

    • Type: string[]
    • Default: ['**/package.json/**', '**/rstest.config.*']

    forceRerunTriggers defines glob patterns that make --changed run the whole test suite when any changed file matches them.

    This is useful for files that can affect many tests but are not always represented in the module graph, such as package manifests, test configs, or generated files executed by child processes.

    If you extend config from an adapter such as withRsbuildConfig, withRslibConfig, or withRspackConfig, Rstest also treats the loaded Rsbuild, Rslib, or Rspack config file as a force-rerun trigger. This adapter-provided trigger is appended to the defaults unless you explicitly configure forceRerunTriggers in your Rstest config. Rstest treats the loaded config file itself and the local files it imports the same way: they are appended only when forceRerunTriggers is not explicitly configured.

    import { defineConfig } from '@rstest/core';
    
    export default defineConfig({
      forceRerunTriggers: [
        '**/package.json/**',
        '**/rstest.config.*',
        'scripts/cli-output/**',
      ],
    });

    For example, if scripts/cli-output/index.js changes and matches the configured pattern, npx rstest run --changed will run all matched test files instead of only tests resolved from related source files.

    forceRerunTriggers uses replace semantics: when you set it, your array becomes the full trigger list. Include the default patterns in your config if you still want them, or set forceRerunTriggers: [] to disable this behavior.