|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 13 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1.2 KB
|
| Rev | Line | |
|---|
| [9af201e] | 1 | # jest-changed-files
|
|---|
| 2 |
|
|---|
| 3 | A module used internally by Jest to check which files have changed since you last committed in git or hg.
|
|---|
| 4 |
|
|---|
| 5 | ## Install
|
|---|
| 6 |
|
|---|
| 7 | ```sh
|
|---|
| 8 | $ npm install --save jest-changed-files
|
|---|
| 9 | ```
|
|---|
| 10 |
|
|---|
| 11 | ## API
|
|---|
| 12 |
|
|---|
| 13 | ### `getChangedFilesForRoots(roots: <Array<string>>, options: ?object): Promise<?object>`
|
|---|
| 14 |
|
|---|
| 15 | Get the list of files and repos that have changed since the last commit.
|
|---|
| 16 |
|
|---|
| 17 | #### Parameters
|
|---|
| 18 |
|
|---|
| 19 | roots: Array of string paths gathered from [jest roots](https://jestjs.io/docs/configuration#roots-arraystring).
|
|---|
| 20 |
|
|---|
| 21 | options: Object literal with keys
|
|---|
| 22 |
|
|---|
| 23 | - lastCommit: boolean
|
|---|
| 24 | - withAncestor: boolean
|
|---|
| 25 |
|
|---|
| 26 | ### findRepos(roots: <Array<string>>): Promise<?object>
|
|---|
| 27 |
|
|---|
| 28 | Get a set of git and hg repositories.
|
|---|
| 29 |
|
|---|
| 30 | #### Parameters
|
|---|
| 31 |
|
|---|
| 32 | roots: Array of string paths gathered from [jest roots](https://jestjs.io/docs/configuration#roots-arraystring).
|
|---|
| 33 |
|
|---|
| 34 | ## Usage
|
|---|
| 35 |
|
|---|
| 36 | ```javascript
|
|---|
| 37 | import {getChangedFilesForRoots} from 'jest-changed-files';
|
|---|
| 38 |
|
|---|
| 39 | getChangedFilesForRoots(['/path/to/test'], {
|
|---|
| 40 | lastCommit: true,
|
|---|
| 41 | withAncestor: true,
|
|---|
| 42 | }).then(files => {
|
|---|
| 43 | /*
|
|---|
| 44 | {
|
|---|
| 45 | repos: [],
|
|---|
| 46 | changedFiles: []
|
|---|
| 47 | }
|
|---|
| 48 | */
|
|---|
| 49 | });
|
|---|
| 50 | ```
|
|---|
| 51 |
|
|---|
| 52 | ```javascript
|
|---|
| 53 | import {findRepos} from 'jest-changed-files';
|
|---|
| 54 |
|
|---|
| 55 | findRepos(['/path/to/test']).then(repos => {
|
|---|
| 56 | /*
|
|---|
| 57 | {
|
|---|
| 58 | git: Set<Path>,
|
|---|
| 59 | hg: Set<Path>
|
|---|
| 60 | }
|
|---|
| 61 | */
|
|---|
| 62 | });
|
|---|
| 63 | ```
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.