![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
jest-changed-files
Advanced tools
A module used internally by Jest to check which files have changed since you last committed in git or hg.
The jest-changed-files npm package is a utility that allows you to determine which files have changed in a git or hg (Mercurial) repository. It is often used in testing environments, particularly with Jest, to identify which tests need to be run based on the changes made to the codebase.
Getting changed files from a Git repository
This feature allows you to get a list of files that have changed since the last commit in a Git repository. The 'lastCommit' option specifies that only changes from the last commit should be considered.
const { getChangedFilesForRoots } = require('jest-changed-files');
(async () => {
const changedFiles = await getChangedFilesForRoots(['./'], { lastCommit: true });
console.log(changedFiles.changedFiles);
})();
Getting changed files from a Mercurial repository
This feature is similar to the previous one but is used for Mercurial repositories. The 'withAncestor' option can be used to find changes that have occurred since the last common ancestor of the current head and the default branch.
const { getChangedFilesForRoots } = require('jest-changed-files');
(async () => {
const changedFiles = await getChangedFilesForRoots(['./'], { withAncestor: true });
console.log(changedFiles.changedFiles);
})();
The git-diff-apply package provides functionality to apply the changes between two commits, branches, or tags. It is similar to jest-changed-files in that it deals with changes in a repository, but it focuses on applying changes rather than just listing them.
node-diff3 is a package for three-way file merging. It compares the differences between files, which can be related to the functionality of jest-changed-files, but it goes further by attempting to merge these differences automatically.
simple-git is a light-weight interface for running git commands in any node.js application. It can be used to get a list of changed files, similar to jest-changed-files, but it also provides a full range of commands to manage Git repositories programmatically.
A module used internally by Jest to check which files have changed since you last committed in git or hg.
$ npm install --save jest-changed-files
hg.isHGRepository(cwd: string): Promise<?string>
Get the root of the mercurial repository containing cwd
or return null
if
cwd
is not inside a mercurial repository.
git.isGitRepository(cwd: string): Promise<?string>
Get the root of the git repository containing cwd
or return null
if
cwd
is not inside a git repository.
hg.findChangedFiles / git.findChangedFiles (root: string): Promise<Array<string>>
Get the list of files in a git/mecurial repository that have changed since the last commit.
import {git, hg} from 'jest-changed-files';
function changedFiles(cwd) {
return Promise.all([
git.isGitRepository(cwd),
hg.isHGRepository(cwd),
]).then(([gitRoot, hgRoot]) => {
if (gitRoot !== null) {
return git.findChangedFiles(gitRoot);
} else if (hgRoot !== null) {
return hg.findChangedFiles(hgRoot);
} else {
throw new Error('Not in a git or hg repo');
}
});
}
FAQs
A module used internally by Jest to check which files have changed since you last committed in git or hg.
The npm package jest-changed-files receives a total of 26,576,248 weekly downloads. As such, jest-changed-files popularity was classified as popular.
We found that jest-changed-files demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.