jest-changed-files
Advanced tools
Comparing version 20.1.0-delta.5 to 20.1.0-echo.1
{ | ||
"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> | ||
} | ||
*/ | ||
}); | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
25607
61