extract method
This commit is contained in:
parent
30447b14f4
commit
9123e1d9a1
|
|
@ -80,13 +80,16 @@ export type TestFileFilter = {
|
||||||
column: number | null;
|
column: number | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function createFileFiltersFromArguments(args: string[], onlyChanged: boolean): Promise<TestFileFilter[]> {
|
export async function detectChangedFiles(): Promise<string[]> {
|
||||||
if (onlyChanged) {
|
const untrackedFiles = childProcess.execSync('git ls-files --others --exclude-standard', { encoding: 'utf-8' }).split('\n').filter(Boolean);
|
||||||
const untrackedFiles = childProcess.execSync('git ls-files --others --exclude-standard', { encoding: 'utf-8' }).split('\n').filter(Boolean);
|
const changedFiles = childProcess.execSync('git diff --name-only', { encoding: 'utf-8' }).split('\n').filter(Boolean);
|
||||||
const changedFiles = childProcess.execSync('git diff --name-only', { encoding: 'utf-8' }).split('\n').filter(Boolean);
|
|
||||||
|
|
||||||
args = [...untrackedFiles, ...changedFiles];
|
return [...untrackedFiles, ...changedFiles];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function createFileFiltersFromArguments(args: string[], onlyChanged: boolean): Promise<TestFileFilter[]> {
|
||||||
|
if (onlyChanged)
|
||||||
|
args = await detectChangedFiles();
|
||||||
|
|
||||||
return args.map(arg => {
|
return args.map(arg => {
|
||||||
const match = /^(.*?):(\d+):?(\d+)?$/.exec(arg);
|
const match = /^(.*?):(\d+):?(\d+)?$/.exec(arg);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue