Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jest-changed-files

Package Overview
Dependencies
Maintainers
5
Versions
175
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-changed-files - npm Package Compare versions

Comparing version 20.1.0-delta.5 to 20.1.0-echo.1

2

package.json
{
"name": "jest-changed-files",
"version": "20.1.0-delta.5",
"version": "20.1.0-echo.1",
"repository": {

@@ -5,0 +5,0 @@ "type": "git",

@@ -14,16 +14,18 @@ # jest-changed-files

### `hg.isHGRepository(cwd: string): Promise<?string>`
### `getChangedFilesForRoots(roots: <Array<string>>, options: ?object): Promise<?object>`
Get the root of the mercurial repository containing `cwd` or return `null` if
`cwd` is not inside a mercurial repository.
Get the list of files and repos that have changed since the last commit.
### `git.isGitRepository(cwd: string): Promise<?string>`
#### Parameters
roots: Array of string paths gathered from [jest roots](https://facebook.github.io/jest/docs/configuration.html#roots-array-string).
Get the root of the git repository containing `cwd` or return `null` if
`cwd` is not inside a git repository.
options: Object literal with keys
* lastCommit: boolean
* withAncestor: boolean
### `hg.findChangedFiles / git.findChangedFiles (root: string): Promise<Array<string>>`
### findRepos(roots: <Array<string>>): Promise<?object>
Get the list of files in a git/mecurial repository that have changed since the
last commit.
Get a set of git and hg repositories.
#### Parameters
roots: Array of string paths gathered from [jest roots](https://facebook.github.io/jest/docs/configuration.html#roots-array-string).

@@ -33,18 +35,28 @@ ## Usage

```javascript
import {git, hg} from 'jest-changed-files';
import {getChangedFilesForRoots} 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');
}
});
}
getChangedFilesForRoots(['/path/to/test'], {
lastCommit: true,
withAncestor: true,
}).then((files) => {
/*
{
repos: [],
changedFiles: []
}
*/
});
```
```javascript
import {findRepos} from 'jest-changed-files';
findRepos(['/path/to/test']).then((repos) => {
/*
{
git: Set<Path>,
hg: Set<Path>
}
*/
});
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc