Security News
vlt Debuts New JavaScript Package Manager and Serverless Registry at NodeConf EU
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
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
getChangedFilesForRoots(roots: <Array<string>>, options: ?object): Promise<?object>
Get the list of files and repos that have changed since the last commit.
roots: Array of string paths gathered from jest roots.
options: Object literal with keys
Get a set of git and hg repositories.
roots: Array of string paths gathered from jest roots.
import {getChangedFilesForRoots} from 'jest-changed-files';
getChangedFilesForRoots(['/path/to/test'], {
lastCommit: true,
withAncestor: true,
}).then(files => {
/*
{
repos: [],
changedFiles: []
}
*/
});
import {findRepos} from 'jest-changed-files';
findRepos(['/path/to/test']).then(repos => {
/*
{
git: Set<Path>,
hg: Set<Path>
}
*/
});
23.4.2
[jest-changed-files]
limit git and hg commands to specified roots (#6732)[jest-circus]
Fix retryTimes so errors are reset before re-running (#6762)[docs]
Update expect.objectContaining()
description (#6754)[babel-jest]
Make getCacheKey()
take into account createTransformer
options (#6699)[jest-jasmine2]
Use prettier through require
instead of localRequire
. Fixes matchInlineSnapshot
where prettier dependencies like path
and fs
are mocked with jest.mock
. (#6776)[docs]
Fix contributors link (#6711)[website]
Fix website versions page to link to correct language (#6734)[expect]
Update toContain
suggestion to contain equal message (#6810)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 14,248,930 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
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
Security News
Research
The Socket Research Team uncovered a malicious Python package typosquatting the popular 'fabric' SSH library, silently exfiltrating AWS credentials from unsuspecting developers.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.