Skip to content

[Feature]: forceRerunTriggers for the changedSince option #15945

@eblocha

Description

@eblocha

🚀 Feature Proposal

Add a forceRerunTriggers configuration, equivalent to vitest's option: https://vitest.dev/config/forcereruntriggers.html

This would force all tests in the suite to re-run when any of the files are changed when changedSince is used to detect affected tests.

Motivation

The changedSince option does not capture situations where configuration or dependencies change. This can make builds using the option pass, when running all tests may fail.

There have been previous issues about automatically re-running when package-lock or setup files change, but this option would make that configurable. See #11774 and #8702.

Other frameworks which have an "affected mode" (nx, vitest) have similar options to capture changes which import analysis cannot detect. This makes builds much more reliable.

Example

// jest.config.js
export default {
  // when the changedSince option is used, run all tests when the setup file or package-lock is different.
  forceRerunTriggers: ["<projectRoot>/test-setup.ts", "package-lock.json"]
}
jest --changedSince=origin/main --forceRerunTriggers=package-lock.json

Pitch

It pairs with an existing option in the core platform, to make it more useful in more situations.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions