![Forrest logo](/images/logo.png)
jest:tldr:6b512
The command "jest --onlyChanged" is used with the Jest testing framework to run only the tests that are related to the code that has been changed since the last commit or the last test run.
By default, Jest executes all the tests defined in the project. However, when using the "--onlyChanged" flag, Jest will first analyze the version control system (such as Git) or the test history to identify the files that have been modified. It then runs only the tests that are associated with those modified files, skipping the tests related to unchanged files.
This command can be helpful in large projects with a large number of tests, as it enables developers to quickly execute only the relevant tests that are impacted by their recent code changes. This saves both time and system resources by avoiding running unnecessary tests.