更改的文件
一个由 Jest 内部使用的模块,用于检查自您上次使用 git 或 hg 执行后哪些文件已经改变 .
安装
$ npm install --save jest-changed-files
API 密码
getChangedFilesForRoots(roots: Array<string>, options: Options): Promise<ChangedFiles>
获取文件列表并重置自上次承诺以来已经改变的文件 .
参数
根: 收集的字符串路径矩阵 笑话根。 。 。 .
选项: 有密钥的对象字元
- 上次承诺:布尔
- 有祖先:布尔
- 已更改
回返
带有密钥的对象文字承诺
- 已更改的文件夹: 设置为 < string>
- 重置 :
- git: 设置为 < string>
- hg: 设置"字符串"
查找Repos( 基础: 阵列): 保证
找一套git和hg的存储器.
参数
根: 收集的字符串路径矩阵 笑话根。 。 。 .
回返
带有密钥的对象文字承诺
- git: 设置为 < string>
- hg: 设置"字符串"
使用量
import {getChangedFilesForRoots} from 'jest-changed-files';
getChangedFilesForRoots(['/path/to/test'], {
lastCommit: true,
withAncestor: true,
}).then(files => {
/*
{
repos: [],
changedFiles: []
}
*/
});
import {getChangedFilesForRoots} from 'jest-changed-files';
getChangedFilesForRoots(['/path/to/test'], {
changedSince: 'main',
}).then(files => {
/*
{
repos: [],
changedFiles: []
}
*/
});
import {findRepos} from 'jest-changed-files';
findRepos(['/path/to/test']).then(repos => {
/*
{
git: Set<Path>,
hg: Set<Path>
}
*/
});