Skip to content

Commit

Permalink
docs: update jest-changed-files Readme (#13663)
Browse files Browse the repository at this point in the history
  • Loading branch information
jfgreffier committed Jan 1, 2023
1 parent e3c54b0 commit d80313f
Showing 1 changed file with 34 additions and 2 deletions.
36 changes: 34 additions & 2 deletions packages/jest-changed-files/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ $ npm install --save jest-changed-files

## API

### `getChangedFilesForRoots(roots: <Array<string>>, options: ?object): Promise<?object>`
### `getChangedFilesForRoots(roots: Array<string>, options: Options): Promise<ChangedFiles>`

Get the list of files and repos that have changed since the last commit.

Expand All @@ -22,15 +22,32 @@ options: Object literal with keys

- lastCommit: boolean
- withAncestor: boolean
- changedSince: string

### findRepos(roots: <Array<string>>): Promise<?object>
### Returns

A Promise of Object literal with keys

- changedFiles: Set\<string>
- repos:
- git: Set\<string>
- hg: Set\<string>

### findRepos(roots: Array<string>): Promise<Repos>

Get a set of git and hg repositories.

#### Parameters

roots: Array of string paths gathered from [jest roots](https://jestjs.io/docs/configuration#roots-arraystring).

### Returns

A Promise of Object literal with keys

- git: Set\<string>
- hg: Set\<string>

## Usage

```javascript
Expand All @@ -49,6 +66,21 @@ getChangedFilesForRoots(['/path/to/test'], {
});
```

```javascript
import {getChangedFilesForRoots} from 'jest-changed-files';

getChangedFilesForRoots(['/path/to/test'], {
changedSince: 'main',
}).then(files => {
/*
{
repos: [],
changedFiles: []
}
*/
});
```

```javascript
import {findRepos} from 'jest-changed-files';

Expand Down

0 comments on commit d80313f

Please sign in to comment.